TITLE: Prime numbers to power 100
QUESTION [7 upvotes]: I made the following observations:
$$ p^{100} \equiv 1 \pmod {1000}$$
$p$ is a prime number other than $2$ and, $5$
I checked the above till $p = 127$ and, want to know the reason for it and whether it is true for all prime numbers except 2 and 5 and if so, what is its proof?

REPLY [3 votes]: You can find this relationship captured in the Carmichael function $\lambda(1000)=100$, representing the largest exponential cycle of any number $\bmod 1000$. For numbers $a$ coprime to $1000$, this ensures that $a^{100}\equiv 1 \bmod 1000$, since cycles shorter than $100$ will nevertheless divide $100$.
This varies from the Euler totient function $\phi(1000) = 400$ for two reasons; powers of $2$ are treated slightly differently and results from distinct prime powers (here $2^3$ and $5^3$) are combined by least common multiple, not by multiplication.