"Prove that if $n$ is coprime to $10$ then $n^{101} \equiv n \pmod{1000}$"
I know that this has something to do with Euler's function, but i'm not sure how to apply it.
A fellow on an IRC channel that I am on answered this question, but I did not understand his process. Written below is his process.
"$n$ is prime to $10$ => $n^{\phi(125)+1} = n^{101} = n \pmod{125}$
since $n^2 = 1 \pmod{8}, n^{50*2+1} = n^{101} = n \pmod{8}$ => $n^{101} = n\pmod{125 * 8}$; Thus if $gcd(n,10)=1$ then $n^{101} = n \pmod{1000}$"
If $n$ is coprime to $10$, why are we allowed to say $n^{\phi(125)+1}$? Eueler's function says if $n$ and $a$ are coprime, then: $a^{\phi(n)} \equiv 1 \pmod{n}$.
I think I just need this part explained and i'll be okay.