<s>[INST] Number Theory : What are the last three digits of $9^{9^{9^9}}?$ I was doing some basic Number Theory problems and came across this problem and was all thumbs :

Find the last three digits of $9^{9^{9^9}}$

How would I go about solving this problem? I am a newbie.
 [/INST] $(10-1)^{9^{9^9}}=\sum\limits_{i=0}^{9^{9^9}}\binom{9^{9^9}}{i}10^i(-1)^{9^{9^9}-i}$ of course we only care when $i$ is $0,1$ or $2$. So we need only calculate 
$(-1)^{9^{9^9}}+\binom{9^{9^9}}{1}10^1(-1)^{9^{9^9}-1}+\binom{9^{9^9}}{2}10^2(-1)^{9^{9^9}-2}=-1+\color{red}{\binom{9^{9^9}}{1}10}-\color{green}{100\binom{9^{9^9}}{2}}$.
So we need only determine the last two digits of $9^{9^9}$ and the last digit of $\binom{9^{9^9}}{2}$ to conclude. 
We first calculate the last digit of $\binom{9^{9^9}}{2}=\frac{9^{9^9}}{1}\frac{9^{9^9}-1}{2}$. The last digit of $9^{9^9}$ is $9$. So the last digit of $9^{9^9}-1$ is $8$. The last digit of $\frac{9^{9^9}-1}{2}$ is $4$ because $9^{9^9}-1$ is a multiple of $4$ since $9\equiv 1\bmod 4$.
Therefore the last digit of $\binom{9^{9^9}}{2}$ is $\color{green}6$.
What are the last two digits of $9^{9^9}$? We use the same trick as before, we want $(10-1)^{9^9}=\sum\limits_{i=0}^{9^9}\binom{9^9}{i}10^i(-1)^{9^9-i}$. But we only care about the first two terms:
$(-1)^{9^9}+\binom{9^9}{1
}10^1(-1)^{9^9-1}=10(9^9)-1$ which ends in $\color{red}{89}$.
Therefore $9^{9^{9^9}}$ is $-1+\color{red}{89(10)}-\color{green}{600}+1000k$ 
and hence ends in $289$.
</s>