Find the remainder when ${{5^5}^5}^5$ is divided by $24$
Hint: $5^{5^5}$ is clearly an odd number.
To know $a^{b^{c^d}}\bmod 24$ you only need to know $b^{c^d}\bmod \varphi(24)$.
To know $b^{c^d}\bmod \varphi(24)$ you only need to know $c^d\bmod \varphi(\varphi(24))$
Lets actually do it:
First note $\varphi(24)=8$, $\varphi(\varphi(24))=4$.
Since $5^5\equiv 1\bmod 4$ we conclude $5^{5^5}\equiv 5^1\bmod 8$.
From here $5^{5^5}\equiv5^1\equiv 5\bmod 8$.
Finally we get $5^{5^{5^5}}\equiv 5^5\bmod 24$
Finally use logarithmic exponentiation:
$5^2\equiv 1,5^4\equiv 1\bmod 24$
therefore $5^5=5\times5^4\equiv 5\times 1\equiv 5 \bmod 24$
Using Carmichael function $\lambda(24)=2$
$\implies a^2\equiv1\pmod{24}$ for $(a,24)=1$
Now $a^{2n+1}=a(a^2)^n\equiv a\cdot1^n\pmod{24}\equiv a$
Here $a=5,2n+1=5^{5^5}$