If $f(x) =x^{x^{x^{x}}}$, determine the last two digits of $f(17) + f(18) + f(19) + f(20).$

elementary-number-theorymodular arithmetic

If
$$ f(x)= x^{x^{x^x}}, $$

then calculate the last two digits of $\displaystyle f(17) + f(18) + f(19) + f(20).$

I know that last two digits of $ f(20)$ will be $00$ and I also tried to find the last two digits by binomial coefficients,

like for $ 19^{19} ,$ we can get the last digit by : $$ {19 \choose 1} \times 20 – 1 $$ will be equal to $79$. Here I expresses $19$ as $20-1$ but for the next step I would need the value of $ 19^{19} $ and that would not be worth it !

Please help me, and tell me some good method to do such type of questions.

Thank you in advance. Please help me out with the tags. I do not know under which section it should come.

Best Answer

Since you seem to be having trouble following the hints given in the comments, I'll give a more extensive explanation.

In order to evaluate $$19^{19^{19^{19}}}\pmod{100}$$ we first want to find the smallest exponent $e$ such that $$19^e\equiv1\pmod{100}$$ Then if $n$ is a positive integer, we can write $n=me+k$ for integers $m$ and $k$, where $0\leq k<e$, so that $$19^n=19^{me}\cdot19^k=\left(19^e\right)^m\cdot19^k\equiv1^m\cdot19^k\equiv19^k\pmod{100}$$

We know $\phi(100)=40$, so by Euler's theorem, $19^{40}\equiv1\pmod{100}$, and the smallest exponent must divide $40$. We find by experiment that the smallest exponent that works is $10.$ (Even though your calculator may not be able to compute $19^{10}$ directly, you only have to retain the last two digits as you compute higher powers, so this is not a problem. You can shortcut the work by repeatedly squaring, and multiplying appropriate powers of $2$.)

Anyway, now we need to know the value of $19^{19^{19}}$ modulo $10$. We do the same thing as before, only we work modulo $10$ instead of modulo $100$ this time. It's clear that $19^2\equiv1\pmod{10}$ so $2$ is the smallest exponent. Now we know $19^{19}$ is odd, so $$19^{19^{19}}\equiv19^1\equiv9\pmod{10},$$ and $$19^{19^{19^{19}}}\equiv19^9\pmod{100}$$

If you've saved the powers of $19$ from when you figured out $19^{10}\equiv1\pmod{100}$, you can easily compute that $$19^9\equiv79\pmod{100}$$

When we try to apply this method to $18^{18^{18^{18}}}$, we run into the problem that Euler's theorem doesn't apply, since $18$ and $100$ are not relatively prime. I see however that Robert Israel has just posted an answer explaining that case, so I'll stop here.

Related Question