How to prove that 2017 divides $1^{2017}+2^{2017}+\dots+2017^{2017}$? [closed]

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


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.


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.