Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
The Logarithm! – k.stm Mar 19 '13 at 19:38
up vote 4 down vote accepted

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$.

share|cite|improve this answer

$N$ in base $10$ has $\lfloor\log_mN\rfloor+1$ digits in base $m$.

share|cite|improve this answer

If $$10^n \le x < 10^{n+1},$$ then $x$ has $n+1$ digits in base $10$ and $$ 4^{n\log_4 10} \le x < 4^{(n+1)\log_4 10} $$ Find out which integers $n\log_{10}4$ is between and which integers $(n+1)\log_{10}4$ is between. That will tell you something about the number of digits that $x$ has in base $4$.

Multiplying the number of base-$10$ digits by $\log_4 10$ gives you the approximate number of base-$4$ digits.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.