# Find first power of 2 with exponent that is a multiple of 10 whose first number is not 1

I've been pondering this quirky fact about powers of 2 for a while now, and I can't seem to formulate it properly in my head to find a proper answer without just using a calculator and trying out numbers till I find the answer.

When talking about memory we usually use Megs, Gigs, etc. And usually these are technically powers of 2.

Kilo = pow(2,10) Meg = pow(2,20) Gig = pow(2,30)

Ok so it seems that 2 to the power of something divisible by 10 is going to be the approximation of 10 to the power of something divisible by 3 (which seems coincidental even strange to me), and by approximation I mean the first digit is a 1 and it has the correct number of digits.

Using experimentation it appears pow(2,299) is the first time this doesn't hold true, but I can't help but think there must be a way to make a formula that gives me the value without experimentation.

I know for example that log 2 is .30102... which is the reason it works for sufficiently small exponents since we want 3 extra digits each time. But what's next?

-
– Zev Chonoles Feb 24 '13 at 3:17
Just to follow up on this, pow(2,299) is the best approximation for pow(1000,30) or 30 orders of magnitude, where "Gig" is 3 orders. I don't think 30 orders of magnitude has an official name. I think it should have one, if it doesn't already. Just so that I can give this phenomenon a name. – codefactor Jan 18 at 22:50
@ZevChonoles you are correct though I was referring to finding the power of 2 that approximates the orders of magnitude which are powers of 1000, and in this case we see that not all of the exponents of these approximations are divisible by 10 – codefactor Jan 18 at 22:56

It sounds like you're asking the first value of $n$ such that

$$10^{3n} < 2^{10n} < 2 \cdot 10^{3n}$$

is false. It will be false because the second inequality is violated, so you seek

$$2^{10n} > 2 \cdot 10^{3n}$$ $$2^{10n-1} > 10^{3n}$$ $$(10n-1) \log 2 > 3n \log 10$$ $$n(10 \log 2 - 3 \log 10) > \log 2$$ $$n > \frac{\log 2}{10 \log 2 - 3 \log 10}$$ $$n > 29.226\ldots$$

(The inequality doesn't reverse when I divide, because I divide by a positive number).

-
This seems right to me. The first integer n where it is false is 30 or pow(2,300) so n > 29.2 makes sense. Thanks for the nice equations. – codefactor Feb 24 '13 at 19:42

So $\log_{10}2^{10k}=(3.010299\dots)k=3k+(.010299\dots)k$, and we want the smallest $k$ such that $(.010299\dots)k\gt\log_{10}2$. So $$k={\log_{10}2\over10\log_{10}2-3}$$ which is a bit under $30$, and the power we want, $10k$, is thus a bit under $300$.

-
It seems you have the right equation but I don't follow how you arrived there. I voted it up but the other answer with the same end result explained it a little better, so I accepted that one. – codefactor Feb 24 '13 at 19:45

As $$2^{10n} = (2^{10})^n = 1024^n = (1.024\times 10^3)^n = 1.024^n\times 10^{3n},$$ you want to find is the smallest $n$ such that $1.024^n \geq 2$. Taking the natural logarithm of both sides, and noting that $\ln x$ is an increasing function on $(0, \infty)$, we have

\begin{align*} \ln 1.024^n &\geq \ln 2\\ n\ln 1.024 &\geq \ln 2\\ n &\geq \frac{\ln 2}{\ln 1.024} \approx 29.23 \end{align*}

so $n = 30$ is the smallest such $n$; as $\ln x$ is a strictly increasing function on $(0, \infty)$ and $1.024 > 1$, $\ln 1.024 > \ln 1 = 0$, so dividing both sides of the second line does not change the inequality.

Therefore $2^{10\times 30} = 2^{300}$ is the first power of $2$, with exponent divisible by $10$, which does not begin with a $1$.

-