I'm having trouble understanding clever applications of Fermat's Little Theorem and its generalization, Euler's Theorem. I already understand the derivation of both, but I can't think of ways to use them in problems that I know I must use them (i.e. the question topic is set).
Here are two questions I had trouble with trying to use FLT and ET:
Find the 5th digit from the rightmost end of the number $N = 5^{\displaystyle 5^{\displaystyle 5^{\displaystyle 5^{\displaystyle 5}}}}$.
Define the sequence of positive integers $a_n$ recursively by $a_1=7$ and $a_n=7^{a_{n-1}}$ for all $n\geq 2$. Determine the last two digits of $a_{2007}$.
I managed to solve the second one with bashing and discovering a cycle in powers of 7 mod 1000, and that may be the easier path for this particular question rather than using ET. However, applying ET to stacked exponents I believe is nevertheless an essential concept for solving more complex questions like number 1 that I wish to learn. It would be helpful if I could get hints on using ET in those two problems and a general ET approach to stacked exponents and its motivation.