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

The hint!!!! Hope it sheds some light: let's assume that we want to get the last 10 decimal digits of another big number, such as: 8^1234. We can do it by using the mod operator: (8^1234)%10000000000. Try Bing, it will give you the answer:

4154645504

Now, instead of raising 8 to 1234, let's now assume that we want the last 10 digits of an even larger number: 8^45671234. Same approach, use the mod operator, unfortunately this time the number is too big for either Bing, or Google, or even WolfranAlpha to return an answer, but anyways, I got the answer to (8^45671234)%10000000000:

0273045504

Now, take a look at these two numbers and look at the common digits towards the end:

(8^1234)%10000000000          = 4154645504
(8^(45671234)%10000000000 = 0273045504

See the "coincidence"? If we're raising a number K to N where N is a number with D digits, the last (D+1) digits of the result will be the same as if we raise the number K to any number of the form d1d2d3...N, where the "di" are digits (from 0 to 9). Got it?

Comments

Popular posts from this blog

Changing the root of a binary tree

Prompt Engineering and LeetCode

ProjectEuler Problem 719 (some hints, but no spoilers)