how tell if a series of power numbers is bigger then others

167 Views Asked by At

I trying to order a list of mathematical expressions in string format as:

"2*2"
"4^1"
"4^2^5"

so far, so good for non exponential operations (^). I could compute the final result.

Except for exponential operations, cos take tooo long to compute, e.g.: $100^{20^{10}}$

My question is:

How tell if :

$1oo^{40}$ is bigger than $2^{22^{20}}$ ?

p.s: without computing the expression.

EDIT

how I can scale in this case

$100^{20^{2^{2}}}$ < $10^{2^{2^{2^{2^{2}}}}}$ ??

3

There are 3 best solutions below

2
On BEST ANSWER

As others have noted, logarithms definitely make things look more comparable.

$$10^{40},2^{22^{20}}$$

$$40,22^{20}\log_{10}(2)$$

We can quickly see that $40<22^{20}$ and that $\log_{10}(2)>0.01$

From this it seems clear that $40<(0.01)22^{20}<22^{20}$.

0
On

My recommendation would be this:
Say you have $100^{40} $ and $2^{22^{20}}$, like you said. Take the log and ask, in this case, if $$\frac {40\log 100}{22^{20}\log 2} = \frac {40}{22^{20}}\log_2 100 < 1?$$ Then just compute the powers until it's under 1 then stop, and try and with both ways switching which number you put on the numerator. This hold up until there's overflow, but it atleast reduces the chance of overflow compared to just trying to do raw computation of the numbers. Surely there is more optimization that can be done though.

0
On

$$\text {(Part 1 )}\quad100^{40}<(2^7)^{40}=2^{280}<2^{22^{2^2}}.$$ $$\text {(Part 2) }\quad 100^{20^{2^2}}=10^{2\cdot 20^{2^2}}<10^{20\cdot 20^{2^2}} =10^{20^{(1+2^2)}}<10^{32\cdot 32^{2^2}}=10^{(2^5)^{(1+2^2)}}=$$ $$=10^{2^{5\cdot (1+2^2)}}=10^{2^{25}}<10^{2^{32}}=10 ^{2^{2^5}}$$ $$\text { which is less than }\quad 10^{2^{2^{16}}}=10^{2^{2^{2^{2^2}}}}.$$ It's usually best to work up from the bottom.