<s>[INST] Proving that $1^n+2^n+3^n+4^n$ $(n\in \Bbb N)$ is divisible by 10 when $n$ is not divisible by 4 I was solving some math problems to prepare for math contests and came across this one:
Prove that $1^n+2^n+3^n+4^n$ $(n\in N)$ is divisible by 10 if and only if $n$ is not divisible by 4.
So, from what I understand, we have to prove that:
$1+16^n+81^n+256^n$ $(n\in \Bbb N)$ is never divisible by 10;
$1+2 \cdot 16^n+3 \cdot 81^n+4 \cdot 256^n$ $(n\in \Bbb N)$ is always divisible by 10;
$1+4 \cdot 16^n+9 \cdot 81^n+16 \cdot 256^n$ $(n\in \Bbb N)$ is always divisible by 10;
$1+8 \cdot 16^n+27 \cdot 81^n+64 \cdot 256^n$ $(n\in \Bbb N)$ is always divisible by 10.
The problem is, these equations seem even more complex than the starting one. How would you prove these? Am I on the right track or is there an easier and more elegant way to do this? Thanks.
 [/INST] To be slightly more concise:
Lemma
For any  prime $p$, $x+x^2+\dots+x^{p-1}  \equiv x(1+x+\dots+x^{p-2}) \equiv x(\frac{x^{p-1}-1}{x-1}) \equiv 0 \pmod p$ iff $x \not \equiv 1 \pmod p$
Note the following:
$$1^{n}+2^{n}+3^{n}+4^{n}\equiv 1+0+1+0 \equiv 0 \pmod 2$$
$$1^{n}+2^{n}+3^{n}+4^{n} \equiv 2^{n}+2^{2n}+2^{3n}+2^{4n} \equiv 0 \pmod 5$$
From the fact that $2$ is a primitive root of $5$, and from the Lemma since $n \not \equiv 0 \pmod 4$ .
Thus, we get that $1^n+2^n+3^n+4^n$ is divisble by $10$ if $n \not \equiv 0 \pmod 4$.
Note that a generalization is possible: $1^{n}+2^{n}+\dots+(p-1)^{n} \equiv 0 \pmod {2p} \Leftrightarrow n \not \equiv 0 \pmod {p-1}$
</s>