I want to calculate the remainder of $666^{666}$ when divided by $1000$. But for the usual methods I use the divisor is very big. Furthermore $1000$ is not a prime, $666$ is a zero divisor in $\mathbb{Z}_{1000}$.
I have some thought about it, here it is...
- There does not exist $n\in\mathbb{N}$ such that $666^n\equiv 1\,\pmod{\!1000}$
- $666$ may be nilpotent with degree $n \leq 666$. In this case $666^{666}\equiv 0\,\pmod{\!1000}$.
- $666$ may be nilpotent with degree $n \geq 666$. If I don't know the exact degree I don't know what to do here.
- $666$ might be non-nilpotent. For example $4\in\mathbb{Z}_6$ is idempotent. But $666$ is not idempotent, as $666^2\equiv 556\,\pmod{\!1000}$, so even if $666$ is not nilpotent I don't see the answer so easily. If $666$ is not nilpotent, and as it is not idempotent, I don't know what to do here.
Any idea?
$666^{666}$ is certainly a multiple of $8$, and Euler's theorem tells us that $$666^{666}\equiv41^{66}\pmod{125}$$ Now, we can do, for example: $$41^{66}\equiv56^{33}\equiv56\cdot11^{16}\equiv56\cdot4^8\equiv56\cdot6^2\equiv16\pmod{125}$$
Thus, since $16$ is a multiple of $8$,
$$666^{666}\equiv 16\pmod{1000}$$