Comparing two numbers written in index form like 2^11 and 3^7 is not difficult, as any calculator would confirm that 2^11 = 2048 < 3^7 = 2187.
However, confirming that a six-digit number raised to the power of another six-digit number would be considerably more difficult.
Using the text file provided below, 22K in size, containing one thousand lines with a base/exponent pair on each line, determine which line number has the greatest numerical value.
(This problem and its text come from Project Euler).
Show solution
Hide solution
The key to this problem is to avoid calculating the enormous numbers that result from the powers given, but to instead break up the computations into logarithms.
A Python script that does this is provided below.