Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
1+2+....+n = n(n+1)/2. That should answer your question :) – Dylan Wilson Dec 22 '10 at 21:22
up vote 2 down vote accepted

This page have a proof for the same.It also includes the the prove that when $n$ is even then this is not true.

share|cite|improve this answer

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$.

share|cite|improve this answer

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\:$).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.