Formula for the number of digits in the number $2^x$

151 Views Asked by At

I'm wondering if there is a formula for the number of digits in $2^x$.

For example if $x = 3$ then the number of digits is equal to $1$ because $2^3 = 8$ or for example if $x = 4$ then the number of digits is equal to $2$ because $2^4 = 16$.

In an attempt to solve this problem on my own I made the following table:

2^1 = 1
2^2 = 1
2^3 = 1
2^4 = 2
2^5 = 2
2^6 = 2
2^7 = 3
2^8 = 3
2^9 = 3
2^10 = 4
2^11 = 4
2^12 = 4
2^13 = 4
2^14 = 5

At first it looks like there is a pattern of threes but then $10$-$13$ ruins it. It's late and I can't think of any other way to approach this problem, any help would be awesome.

The question is $2^x \ge 100\,000\,000$ digits.

1

There are 1 best solutions below

4
On BEST ANSWER

Number of digits in $n$ is given by $1+\lfloor\log_{10}(n) \rfloor$. Hence, in your case, the number of digits in $2^x$ is given by $$1+\lfloor x \log_{10}2 \rfloor$$ where $\lfloor y \rfloor$ is the greatest integer $\leq y$. For instance, $\lfloor 3.4 \rfloor =3$; $\lfloor 4.1244 \rfloor =4$; $\lfloor -6.0926 \rfloor =-7$;