Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How many of the numbers $2^m$ (where $0\le m\le M)$ have leading digit $1$?

My trial -

Since leading digit $=1$, whenever $2^m$ reaches or just crosses a $10^x$ and is less than $2 \cdot 10 ^ x$, that $m$ is eligible i.e.

$$10^x \le 2^m \lt 2\cdot 10^x.$$

But $x$ also depends on the current $m$, so $x$ must also satisfy

$$(m-1)\cdot \log 2 \le x \lt m \cdot \log 2$$ (which directly follows from the previous inequality).

So the final summation is:

$$\sum\limits_{(x, m)}\left([10^x \le 2^m \lt 2\cdot 10^x]\cdot[(m-1)\log 2 \le x \lt m \log 2]\cdot[0 \le m \le M]\right).$$

I think I am making it a bit too complex, my main confusion is regarding the manipulation of $x$, can anyone help? (The brackets are Iverson notation which is $1$ if true and $0$ if false).

share|cite|improve this question
Sure you are making it too complex, your first two conditions are the same. And just sum over one index, not two. – vonbrand Jan 24 '13 at 0:22
up vote 3 down vote accepted

If $2^m$ starts with a $1$ then $2^{m-1}$ and $2^{m+1}$ do not. And if $2^m$ has one more decimal digit than $2^{m-1}$ then it must start with a $1$.

So all you need to know is how many powers of $10$ are less than or equal to $2^M$. This is $$\lfloor 1+ \log_{10} 2^M \rfloor = 1+\lfloor M\log_{10} 2\rfloor $$ where you need to add $1$ to deal with $2^0=1$. For $M \gt 0$ you could instead write $\lceil M\log_{10} 2\rceil$.

share|cite|improve this answer
Thank you! Totally understood it. – Andariel Oct 21 '12 at 15:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.