Sum of $n$ consecutive numbers divided by $n$ I was trying to write a poker program yesterday, and trying to figure out a way to tell the computer how to detect a straight. I realized that if you add $5$ consecutive numbers and divide by $5$, you'll get no remainder. I tried for $6$ consecutive numbers, but it didn't work. It turns out it only works for odd numbers. Really silly question, but does this 'method' have a name? Has it been proven that for all odd $n$, the sum of any $n$ consecutive numbers divided by $n$ yields a remainder of zero?
 A: Yes, If $n=2k+1$, write the numbers as
$a - k, a-(k-1), \dots,a-1, a, a + 1, \dots, a+(k-1), a+k$
Adding gives you $na$ which is divisible by $n$.
Try something similar for even $n =2m$ and you see that the sum is $m \mod n$, which is not divisible by $n$.
A: This page have a proof for the same.It also includes the the prove that when $n$ is even then this is not true.
A: HINT $\ $ The sum is $\rm\ 0 + 1 +\:\cdots\:+\: n-1\ \ (mod\ n)\:.\: $ Pairing each summand $\ne 0\:$ with its negation shows that the sum is $\rm\: \equiv 0\ \ (mod\ n)\:.\ \ $ Note: $\rm\ - x\ \equiv\ x\ \Rightarrow\ 2\ x \equiv 0\ \Rightarrow\ x\equiv 0\ \:$ since $\rm\:n\:$ is odd.
If $\rm\:n\:$ is even then the above argument demonstrates simply that the sum reduces to the sum over the fixed points of the negation map, viz. $\rm\ 0,\ n/2\:.\ $ Therefore the sum is  $\rm\:\equiv n/2\ \ (mod\ n)\:.$
This is a special case of Wilson's theorem for groups, e.g. see here and here -
which highlight the key role played by the reflection / involution symmetry (here negation $\rm\ x\to -x\:$).
