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.
 A: $1^n+2^n+3^n+4^n$ is divisible by $10$ if and only if it's divisible by $2$ and $5$.
Clearly $1^n+2^n+3^n+4^n$ is even for all $n\in\mathbb Z^+$, so let's work with mod $5$.
If $n=4k$ for some $k\in\mathbb Z^+$, then:
$$1^k+16^k+81^k+256^k\equiv 1^k+1^k+1^k+1^k\equiv 4\not\equiv 0\pmod{5}$$
If $n$ is odd, then:
$$1^n+2^n+3^n+4^n\equiv 1^n+2^n+(-2)^n+(-1)^n\pmod{5}$$
$$\equiv 1^n+2^n-2^n-1^n\equiv 0\pmod{5}$$
If $n=4k+2$ for some $k\in\mathbb Z_{\ge 0}$, then:
$$1^n+4\cdot 16^k+9\cdot 81^k+16\cdot 256^k\pmod{5}$$
$$\equiv 1+(-1)\cdot 1^k+(-1)\cdot 1^k+1\cdot 1^k\equiv 1-1-1+1\equiv 0\pmod{5}$$
A: The sum $S_n=1^n+2^n+3^n+4^n$ is clearly always even, so it suffices to show that it is divisible by $5$ if and only if $n$ is not divisible by $4$.
Working mod $5$, we have
$$S_n\equiv1^n+2^n+(-2)^n+(-1)^n=(1+2^n)(1+(-1)^n)$$
so we see that $S_n\equiv0$ mod $5$ if $n$ is odd, since $1+(-1)^n=1-1=0$ when $n$ is odd.  On the other hand, if $n=2m$ is even, then
$$S_n\equiv2(1+2^{2m})=2(1+4^m)\equiv2(1+(-1)^m)$$
so we see that $S_{2m}\equiv0$ mod $5$ if $m$ is odd, and $S_{2m}\equiv4\not\equiv0$ mod $5$ if $m$ is even.
A: 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}$
