[Math] Last two digits of $17^{17^{17}}$

decimal-expansionelementary-number-theoryexponentiationmodular arithmetic

For a problem set, we had two find the final two digits of 17^17^17

So what I did was find the last digit of 17^17 and then take 17^of that last digit of 17 and then find the last two digits of that number. I got the last two digits as 17.

Is my method correct, if not, what is the method and what is your answer? Thanks

Best Answer

You get to use arithmetic modulo $100$ when all you care about is the last two digits. Also, since $\varphi(100)=40$ and $17$ is relatively prime to $100$, you get to do arithmetic modulo $40$ in exponents.

So you can first focus on $17^{17}$ modulo $40$: $$\begin{align} 17^{17}&\equiv17\cdot289^8&\mod40\\ &\equiv17\cdot9^8&\mod40\\ &\equiv17\cdot81^4&\mod40\\ &\equiv17\cdot1^4&\mod40\\ &\equiv17&\mod40\\ \end{align}$$

So we have that $$17^{17^{17}}\equiv17^{17}\mod100$$

$$\begin{align} 17^{17^{17}}&\equiv17^{17}&\mod100\\ &\equiv17\cdot289^8&\mod100\\ &\equiv17\cdot89^8&\mod100\\ &\equiv17\cdot(-11)^8&\mod100\\ &\equiv17\cdot121^4&\mod100\\ &\equiv17\cdot21^4&\mod100\\ &\equiv17\cdot441^2&\mod100\\ &\equiv17\cdot41^2&\mod100\\ &\equiv17\cdot(50-9)^2&\mod100\\ &\equiv17\cdot(2500-900+81)&\mod100\\ &\equiv17\cdot81&\mod100\\ &\equiv17\cdot(-19)&\mod100\\ &\equiv-\left(18^2-1\right)&\mod100\\ &\equiv-323&\mod100\\ &\equiv77&\mod100\\ \end{align}$$