Numbers with the first digit of 1 How many numbers written as $2^m$ for $0 \le m \le M$ have a first digit of 1 in the decimal system? For example $2^5 = 32 $ doesn't have a first digit of 1, but $2^7 = 128 $ has, so from 0 to 1000 the amount of numbers written as $2^m$ is 3(1,16,128)

The answer is exactly equal to the number of digits in the decimal expansion of $2^N$, which is $\lfloor N\log_{10}2 +1\rfloor$
This is because there is exactly one power of two that starts with $1$ and has $k$ digits for every positive $k$.
