Number Systems – Relationship Between Base and Number of Digits

number-systems

For instance, the number $1000$ takes $4$ digits in base $10$, $10$ digits in base $2$, $3$ digits in base $20$, and $2$ digits in base $1000$.

What is the mathematical relationship between number of digits and base?

Best Answer

Let $n$ be a positive integer. The base $b$ representation of $n$ has $d$ digits if $b^{d-1}\le n<b^d$, which is the case if $d-1\le\log_b n<d$, or $\lfloor\log_bn\rfloor=d-1$. The number of digits in the base $b$ representation of $n$ is therefore

$$\lfloor\log_bn\rfloor+1=\left\lfloor\frac{\ln n}{\ln b}\right\rfloor+1\;.$$

When $n$ is large compared with $b$, it’s roughly inversely proportional to $\ln b$.

Related Question