How to convert any base 10 integer to a rational power of 2?

48 Views Asked by At

For example, through (lots of) trial and error with a calculator, I figured out that:

1.551e+25 is approximately equal to 2^83.6814

Is there an equation or algorithm for a conversion like this?

Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

Given a number $N$ you want to find a number $x$ such that $2^x\approx N$. By definition $$x=\log_2N=\frac{\log N}{\log 2}.$$ This will not be a rational number in general, but you can round it to get a good approximation.