Fifth last digit of a huge number How can I find the fifth last digit of $5^{5^{5^{5^5}}}$? I tried to evaluate $5^{5^{5^{5^5}}}\pmod {100000}$. But the exponent is so huge that I'm unable to evaluate it. Also, $(5,100000)=5$ , so $5$ and $100000$ are not coprime, so Euler's totient theorem seems to be useless.
 A: Your title asks one question ("fifth last digit") and the body of your question asks a different one ("number modulo 10,000"), which is a bit confusing. Fortunately the same answer applies to both.
The last five digits of the 5th, 6th, 7th,... 13th powers of 5 are 03125, 15625,78125, 90625, 53125, 65625, 28125, 40625, 03125, at which point the sequence obviously repeats. Thus the last 5 digits of $5^n$ (for $n\ge 5$) depend only on the value of $n\pmod 8$.
Your number, $5^{5^{5^{5^5}}}$, is $5^n$ where $n=5^{5^{5^5}}$. To know its last five digits, we need to work out the value of $n\pmod 8$. The remainders after dividing the 0th, 1st and 2nd powers of 5 by 8 are 1, 5, 1, after which the sequence obviously repeats. Thus odd powers of 5 equal 5 modulo 8 and even powers of 5 equal 1 modulo 8.
$n=5^{5^{5^5}}$ is an odd power of 5, so $n\pmod{8}=5$. Consequently the last 5 digits of $5^{5^{5^{5^5}}}=5^n$ are 03125. Therefore:


*

*The answer to the question asked in your title is "0".

*The answer to the question asked in the body is "3125".

