8
$\begingroup$

I have to find the last two decimal digits of the number $9^{{9}^{9}}$.

That's what I did:

$$m=100 , \phi(m)=40, a=9$$ $$(100,9)=1, \text{ so from Euler's theorem,we have :} 9^{40} \equiv 1 \pmod{100}$$

$$9^{{9}^{9}} \equiv 9^{9^{2+2+2+2+1}} \equiv 9^{9^2 \cdot 9^2 \cdot 9^2 \cdot 9^2 \cdot 9} \equiv 9^{81 \cdot 81 \cdot 81 \cdot 81 \cdot 9} \equiv 9^{(40+40+1) \cdot (40+40+1) \cdot (40+40+1) \cdot (40+40+1) \cdot 9} \equiv (9^{(40+40+1)})^{(40+40+1) \cdot (40+40+1) \cdot (40+40+1) \cdot 9} \equiv 9^9 \equiv 9^4 \cdot 9^4 \cdot 9 \equiv 6561 \cdot 6561 \cdot 9 \equiv 3721 \cdot 9 \\ \equiv 21 \cdot 9 \equiv 89 \pmod{100}$$

So,the last two digits are $8 \text{ and } 9$. $$$$But,is there also an other way two calculate the last two digits of $9^{{9}^{9}}$ or is the above the only one?

$\endgroup$
  • 2
    $\begingroup$ The Chinese remainder theorem might help, but this looks efficient enough already. You have a typo, by the way, the last equation should be mod 100 :) $\endgroup$ – Thomas Jun 21 '14 at 14:23
  • $\begingroup$ @Thomas How could I use the Chinese remainder theorem? $\endgroup$ – evinda Jun 21 '14 at 14:42
  • $\begingroup$ From your calculation you want the exponent $\mod 40$. So you want $9^9 \mod 40$, but as you show $9^2=1 \mod 40$ so $9^9=9 \mod 40$ and then $9^{9^9}=9^9 \mod 100$ $\endgroup$ – i. m. soloveichik Jun 21 '14 at 15:35
  • $\begingroup$ From Euler you get that $a^{\phi(100)}\equiv a^{40} \equiv 1 \pmod{100}$. The Chinese remainder theorem gives the sharper $a^{\text{lcm}(\phi(2^2),\phi(5^2))}\equiv a^{20} \equiv 1 \pmod{100}$. This is also known as Carmichael's theorem. $\endgroup$ – Klaas van Aarsen Jun 21 '14 at 19:07
  • $\begingroup$ Yes, thank you!!! @Did :) $\endgroup$ – evinda Mar 13 '15 at 0:17
8
$\begingroup$

Key remark: By the binomial theorem, for every odd $k$, $(10-1)^k=n+10\cdot k-1$ for some integer $n$ which is a multiple of $100$. Since $10\cdot k=10\cdot\ell(k)\bmod{100}$ where $\ell(k)$ denotes the last digit of $k$, this shows that, for every odd $k$, $9^k=10\cdot \ell(k)-1\bmod{100}$.

First application: $\ell(9)=9$, hence the key remark above yields $9^9=10\cdot \ell(9)-1=89\bmod{100}$.

Second application: our first application implies that $\ell(9^9)=9$ hence, using the key remark once again but this time for $k=9^9$, one gets $9^k=10\cdot\ell(k)-1=89\bmod{100}$.

And so on: for every tower of nines, $9^{9^{9^{9^{\cdots}}}}=89\bmod{100}$.

$\endgroup$
3
$\begingroup$

You could also just do modular exponentiation and take note of the periods.

The powers of $9 \mod 100$ are: 1, 9, 81, 29, 61, 49, 41, 69, 21, 89, 1, 9, 81, 29, 61, 49, ... They have a period of $10$. This means that if $n \equiv 9 \mod 10$, then $9^n \equiv 89 \mod 100$. Since $9^9 = 387,420,489$, this means that $9^{9^9} \equiv 89 \mod 100$.

$\endgroup$
2
$\begingroup$

Let $k$ be the order of $9$ mod $100$. Then $$1\equiv 9^k=(10-1)^k \equiv 10\binom{k}{1}\cdot 10(-1)^{k-1}+(-1)^k\pmod{100}$$ It implies that $1=\pm (10k-1)\pmod{100}$. The minimal integer which satisfies this condition is $k=10$. It follows that $$9^{9^9} \equiv 9^9 \equiv 9^{-1}\equiv 89\pmod{100}.$$

$\endgroup$
0
$\begingroup$

A variant to minimise the computation time of the order of $9\bmod100$: by the Chinese remainder theorem, $$\mathbf Z/100\mathbf Z\simeq\mathbf Z/4\mathbf Z\times \mathbf Z/25\mathbf Z. $$ Now $\varphi(25)=20$, and $9\equiv 1\mod4$. Hence $9^{20}\equiv 1\mod100$, so the order of $9$ is a divisor of 20.

Fast exponentiation algorithm shows it has order $10$. Thus $$9^{9^9}\equiv9^{9^9\bmod 10}\equiv 9^{(-1)^9\bmod 10}\equiv 9^{-1}\mod100. $$ Bézout's identity $\;100_11\cdot 9=1\;$ then shows $\; 9^{-1}\equiv -11\equiv 89\mod100$.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.