Why do we add 1 to logarithms to get number of digits?

906 Views Asked by At

I know it's super basic but why do we add 1 to logarithms to get the number of digits in a number?

For example:

log10(33) + 1 = 2.5 which means the number 33 has 2 digits (the integer part of 2.5)

1

There are 1 best solutions below

0
On BEST ANSWER

Your question is about the number of digits and the reason for the $1$ in $$1+[log(n)]$$

Notice if a number has $d$ digits, then the number is between $10^{d-1}$ and $10^{d}$

Therefore the logarithm base $10$ of that number is between $d-1$ and $d$.

If you take the integer part of the logarithm you will get $d-1$ instead of $d$

Thus you add $1$ to $d-1$ and you get $$d=1+[log(n)]$$.