Number of solution for $2^x=n$-digit number? Let us consider the equation $2^x=n$-digit number, where $x$ is an integer.
Now I noticed that when $n$ is of the form $3a+1$ then there are 4 possible solution for $x$, otherwise only $3$ solutions.
Is it actually true and is there any proof to it?
I have tried up to 15-digit numbers and it remains true up to that but I cannot figure out a proof to it?
 A: The first counterexample (not counting single digit numbers) is for $31-$digit numbers.  For those there are only three, though you would have predicted $4$.  The three exponents are $100,101,102$.  $2^{103}=1.014\cdots \times 10^{31}$ just barely has $32$ digits. After that the claim is inaccurate...for $34$ there are only $3$, while for $35$ there are $4$.  
To solve the problem for a general $n$ it is easiest to start by ignoring the fact that the exponent has to be a natural number.  In that case the first $x$ that gets us an $n-$digit number is $$x_{\min}=\log_2(10^{n-1})=(n-1)\log_2(10)$$
and the last is $$x_{\max}=\log_2(10^n-1)$$ which is slightly less than $n\log_2(10)$
It follows that the answer is $$\lfloor x_{\max}\rfloor-\lfloor x_{\min}\rfloor=\lfloor \log_2(10^{n}-1)\rfloor-\lfloor (n-1)\log_2(10)\rfloor$$
the property you have noticed follows from the fact that $$\log_2(10)=3.321928$$
So, using the approximations  noted above and ignoring the floors we see that the answer should always be about $$n\log_2(10)-(n-1)\log_2(10)=\log_2(10)$$
The rest arises from the rounding properties of the floor and the fact that $$3\log_2(10)=9.965$$
is just a little less than an integer.
A: Note that $2^x$ is an $n$-digit number if and only if
$$
10^{n-1} \le 2^x < 10^n.
$$
Taking logarithms this is equivalent to
$$
(n-1)\cdot L \le x < n\cdot L, \quad\text{where $L=\log_2(10)=\frac{\log(10)}{\log(2)}$.}
$$
Hence, you are interested in the number of integers in the interval
$$\Big[\ (n-1)L\ ,\ nL\ \Big).$$
Note that the width of each such interval is $L \approx 3.322$,
so there are at least $3$ and at most $4$ integers in each interval.
In order to have $4$ solutions, we need
$$\{ nL \} < \{ L \} \approx 0.322,$$
where $\{\dots\}$ denotes the fractional part of a positive real number.
Since $L$ is irrational, the sequence of fractional parts of $nL$ is non-periodic and I don't think you will find a simple condition on $n$ to get $4$ solutions. However, since $3L$ is almost an integer, it is close to $3$-periodic behaviour at first, which is what you observed.
