# Prove that a given sequence is periodic modulo m

How can one tell that a given sequence is perodic modulo m?

For example its easy to see that the sequence $1^1, 2^2, 3^3, \dots$ is periodic modulo 10. But how can we prove this?

-
Euler's totient theorem (en.wikipedia.org/wiki/Euler's_theorem) is a good start. –  Qiaochu Yuan Mar 15 '11 at 20:14

HINT $\rm\ \ \ \ \ \ \ \:mod\ 5\::\ (N+20)^{N+20}\ \equiv\ N^{20}\ N^N\ \equiv\ N^N\$ for $\rm\ N\not\equiv 0\$

Generally $\rm\ \ mod\ P\::\ (N+P(P-1))^{N+P(P-1)}\ \equiv\ N^N\ N^{P(P-1)}\ N^N\ \equiv\ N^N\$ for $\rm\ N\not\equiv 0$

-