I'm a little bit stuck with this problem I hope you can help. I want to find the last digit of a power tower using Euler's theorem: \begin{align} q &= 10, \\ \varphi(q) &= 4, \\ \varphi(\varphi(q)) &= 2, \\\varphi(\varphi(\varphi(q))) &= 1. \end{align} \begin{align} 625703 ^{\displaystyle 43898 ^{\displaystyle 614961 ^{\displaystyle 448629}}} &\equiv (625703 \bmod 10)^{\displaystyle (43898 \bmod \varphi(10))^{\displaystyle (614961 \bmod \varphi(\varphi(10)))^{\displaystyle (448629 \bmod \varphi(\varphi(\varphi(10))))}}} \mod 10 \\ &\equiv 3^{\displaystyle 2^{\displaystyle 1^{\displaystyle 0}}} \mod 10 \\ &\equiv 3^{\displaystyle 2^{\displaystyle 1}} \mod 10 \\ &\equiv 3^{\displaystyle 2} \mod 10 \\ &\equiv 9 \mod 10 \end{align} According to this approach the last digit of the power tower must be 9. However, the right solution is 1 (see here) - what am I doing wrong?
This approach is based on the following two answers
computing ${{27^{27}}^{27}}^{27}\pmod {10}$
What's a general algorithm/technique to find the last digit of a nested exponential?