Proof that $x^{(n+4)} \bmod 10 = x^n \bmod 10\,$ for $\,n\ge 1$ While solving a programming challenge in which one should efficiently compute the last digit of $a^b$, I noticed that apparently the following holds (for $n > 0$)
$x^{(n+4)} \mod 10 = x^n \mod 10$
How can this be proven?

Hint
$$ x^{n} \left( x^4 - 1 \right) \equiv x^{n} \left( x^2 - 1 \right) \left( x^2 + 1 \right)\equiv  \left( x - 1 \right) x \left(x+1\right) x^{n-1} \left( x^2 + 1 \right) \pmod{2}\\
x^{n} \left( x^4 - 1 \right) \equiv x^{n} \left( x^2 - 1 \right) \left( x^2 + 1 \right)\equiv  x^{n} \left( x^2 - 1 \right) \left( x^2 -4 \right)\pmod{5}\\
\equiv x^{n-1} \left( x- 2 \right) \left( x- 1 \right) x\left( x+2 \right) \left( x+ 2 \right) \pmod 5
$$
Now use the fact that one of $x-1$ or $x$ is even, and that among 5 consecutive integers one is a multiple of 5.
