Solution of the Week #305 - Power Tower

If you try to calculate the number you won’t get very far. 5^7^5 is already way too large for a calculator, at over 11000 digits. The number of digits in the entire number is unimaginably large. But of course we only need the final five.

If we look at the pattern of the final five digits of 5^n, (also known as the remainder of 5^n when divided by 100000), we see a nicely repeating pattern. Once the numbers are big enough, the final five digits cycle around just eight options.

So to find the last five digits of 5^(very large number), we only need to know the remainder of the (very large number) when divided by 8.

But the (very large number) we are concerned with is equal to 7^(quite large number), and the remainder of 7^n when divided by 8 alternates between just two numbers: 1 when (quite large number) is even and 7 when (quite large number) is odd.

But the (quite large number) is equal to 5^(large number). 5 to the power of any whole number will be odd, since 5 is odd. Therefore 7^(quite large number) gives a remainder of 7 when divided by 8. Therefore the final five digits of 5^(very large number) are 78125.