2^(3^(4^(5^(6^(7^(8^9)))))) - Part I

The problem comes from the IBM Ponder This October 2014 Challenge:


What are the last 10 decimal digits of 2^(3^(4^(5^(6^(7^(8^9))))))?

This is a big number.
If you just take 8^9, you'll end up with 134,217,728. Now try raising, say, 2 to the power of this number, or 2^134,217,728. For comparison sake, the number of atoms in the universe is less than 2^324.

The problem is asking for the last 10 decimal digits, so that should have been an important clue. It should have rang a bell for two key ideas behind solving this problem:
1) Modular Arithmetic: to get the last 3 digits of 1234, all I have to do is calculate 1234%(10^3)
2) Big Integers. Try Binging for Big Integers in C#.

Solution in the next post. Have fun!


Popular posts from this blog

LeetCode: Minimum Moves to Equal Array Elements