[Math] Euler theorem, finding last digits

number theory

Find the last $3$ digits of ${{7^{7}}^7}^7$.

I want to find the last $3$ digits, so I'll work with (mod $1000$).

With Euler's Theorem, $7^{\varphi(1000)} \equiv 1$(mod $1000)$.

We have $\varphi(1000)=\varphi(2^35^3)=400$. Therefore, $7^{400} \equiv 1$(mod $1000)$.

With some calculation, I find $7^{7} \equiv 343$(mod $400)$.

What do I have to do now? Thanks in advance.

Best Answer

You need $7^{7^7}$ modulo $400$. To calculate this, you can reduce $7^7$ modulo $\phi(400)=160$. This gives you $7^{7^7}\equiv 7^{23}\equiv 343\mod 400$

Hence, $7^{7^{7^7}}\equiv 7^{343}\equiv 343\mod 1000$.

So, the last three digits are $343$.