Let $k \in \mathbb N $ .Prove that $n^k \equiv n $ ( mod $5$ ) for all $ n\in \mathbb Z $ iff $k \equiv 1$ ( mod $4$ )
I was trying to solve this using the corollary of Fermat's little theorem , i.e $n^p \equiv n$ ( mod $p$) for all $n \in \mathbb Z $ , but I got stuck. Need some help.
Hint: if $n$ is a multiple of $5$, so is $n^k$. If not, try showing that $n^{k-1}\equiv 1$ mod $5$ if $k\equiv 1$ mod $4$.
Edit: missed the "iff". To show that it doesn't work if $k\not\equiv 1$ mod $4$, use the if part and $n=2$. E.g. if $k\equiv 3$ mod $4$ then $2^{k-2}\equiv 2$ so $2^k\equiv 8\not\equiv 2$.