Let $a_n$ be the sequence defined by $a_1$ = 3, $a_{n+1}$ = $3^{a_n}$ . Let $b_n$ be the remainder when $a_n$ is divided by 100. What is $b_{2004}$?
I found this question online and I know its modular arithmetic but I'm not sure how I should be dealing with the ${{{3^{3}}^{3}}^{3}}^{...}$. Is there any way to apply Euler's theorem or something? Need a clue... Thanks.
It turns out that $b_n=87$ when $n>2$. In fact, $3^{3^3}=7\,625\,597\,484\,987$ and therefore $b_3=87$. And, by the Euler-Fermat theorem, $3^{40}\equiv1\pmod{100}$. So$$3^{87}\equiv3^7\equiv87\pmod{100}.$$