How can I prove that $2017 \mid 1^{2017}+2^{2017}+\dots+2017^{2017}$?

I tried proving it with the use of modulo, however it was to no avail. Afterwards, I tried researching, for possible theorems, that may help, but that bore no fruit, either.

Can you guys please help me proving it, as I am stuck?

Thanking you in advance.



As $2017$ is prime the expression is equivalent to $$1+2+...+2017\equiv \frac{1}{2}(2017)(2018) \equiv 0\mod{2017}$$ By using Fermats little theorem.

  • $\begingroup$ Not quite. The last term ($2017$) in your sum should be $0$ since $a^p\equiv a \mod p$ is only true for $(a,p)=1$. But even so, the overall approach and result are valid. $\endgroup$ – Keith Backman Feb 27 at 18:41
  • 4
    $\begingroup$ @KeithBackman $a^p\equiv a\pmod p$ is true for all $a$. It's $a^{p-1}\equiv 1\pmod p$ with which you have to be careful. $\endgroup$ – Wojowu Feb 27 at 18:42
  • $\begingroup$ It can be done without any knowledge of that formula by simply paring up inverses as I explain in my answer. In fact the formula can be derived in a similar way - see the link on Gauss's grade school trick I give there. These are nice simple ways to illustrate the utility of (reflection) symmetry $\endgroup$ – Bill Dubuque Feb 27 at 18:52
  • 1
    $\begingroup$ "Not quite. The last term (2017) in your sum should be 0" Um... $0$ is equivalent to $2017$. This is a statement of equivalency, not equality. The last term being $2017$ is every bit as correct and valid as $0$. $\endgroup$ – fleablood Feb 27 at 19:03

Hint $\bmod 2017\!:\ n^{\large 2017}$ cancels with $\,(\overbrace{2017}^{\large \equiv\ 0\ }\!-\!n)^{\large 2017}\!\equiv -n^{\large 2017},\,$ leaving only $\,2017^{\large 2017}\!\equiv 0\,$

Remark $ $ This method of cancelling out terms by pairing up inverses in sums (and products) is frequently useful, e.g. see Wilson's Theorem and related problems and see Gauss's grade school trick. It is a special case of exploiting involution (reflection) symmetry, here inversion (negation).

  • $\begingroup$ Note that the same proof works if we replace $2017$ by any odd natural. $\endgroup$ – Bill Dubuque Feb 28 at 2:30

Just for another way to see this: Let $a \pmod {2017}$ be neither $0$ nor $1$ and let $S$ denote the sum. Since $a\not \equiv 0 \pmod {2017}$, multiplication by $a$ permutes the residue classes $\{1,\cdots, 2017\}$. Thus $$S\equiv \sum_{i=1}^{2017} (ai)^{2017}\equiv a^{2017}\times \sum_{i=1}^{2017} i^{2017}\equiv aS\implies S\equiv 0$$

In the above, all congruences are $\pmod {2017}$, of course.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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