Proving $1+2^n+3^n+4^n$ is divisible by $10$

How can I prove

$$1+2^n+3^n+4^n$$ is divisible by $10$ if $$n\neq 0,4,8,12,16.....$$


Solution 1:

We consider it $(\mathrm{mod}\;2)$ and $(\mathrm{mod}\;5)$ separately.

Clearly $1$ and $3^n$ are odd, while $2^n$ and $4^n$ are even, so their sum is even.

Now by Fermat's Little Theorem, when $a$ is not divisible by $5$, $a^5 \equiv a \mod 5$, so $a^4 \equiv 1 \mod 5$. Thus we only need to check $n=1$, $2$, and $3$. (note that $1$, $2$, $3$, and $4$ are not divisible by $5$. If $n=1$, we get $1+2+3+4=10$, which is divisible by $5$ If $n=2$, we get $1+4+9+16=30$, which is divisible by $5$. If $n=3$, we get $1+8+27+64=100$, which is divisible by $5$.

Thus we have proved it $(\mathrm{mod}\;5)$ and we are done.

Solution 2:

$$3\equiv1\pmod2\implies 1+2^n+3^n+4^n\equiv0\pmod2$$

If $n$ is odd, $1+4^n=1^n-(-4)^n$ is divisible by $1-(-4)=5$

Similarly, $2^n+3^n\equiv0\pmod5,$

For $n=4k+2,2^{4k+2}\equiv4\pmod5,3^{4k+2}\equiv-1,4^{4k+2}\equiv1$