Number of Binary Digits in Power of 10

From ProofWiki
Jump to navigation Jump to search

Theorem

Let $n$ be a positive integer.

Expressed in binary notation, the number of digits in the $n$th power of $10$:

$10^n$

is equal to:

$\ceiling {n \log_2 10}$

where $\ceiling x$ denotes the ceiling of $x$.


Examples

$1000$

When expressed in binary notation, the number of digits in $1000$ is $10$.


Proof

Let $10^n$ have $m$ digits when expressed in binary notation.

By the Basis Representation Theorem and its implications, a positive integer $x$ has $m$ digits if and only if:

$2^{m - 1} \le x < 2^m$

Thus:

\(\displaystyle 2^{m - 1}\) \(\le\) \(\, \displaystyle 10^n \, \) \(\, \displaystyle <\, \) \(\displaystyle 2^m\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle m - 1\) \(\le\) \(\, \displaystyle \map {\log_2} {10^n} \, \) \(\, \displaystyle <\, \) \(\displaystyle m\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle m - 1\) \(\le\) \(\, \displaystyle n \log_2 10 \, \) \(\, \displaystyle <\, \) \(\displaystyle m\)

Because a power of $10$ cannot equal a power of $2$, it will always be the case that:

$m - 1 < n \log_2 10 < m$

and so:

$m - 1 < n \log_2 10 \le m$

Hence from Integer equals Ceiling iff Number between Integer and One Less:

$m = \ceiling {n \log_2 10}$

$\blacksquare$


Sources