How does the logarithm returns the number of digits of a number?

481 Views Asked by At

A number written in base b is a polynomial $\sum {(a_i*b^i)}=a_n...a_3a_2a_1a_0$

The logarithm in base b of the number gives the number of digits (up to with a constant=1 difference), and I want to understand how it does that. Note that as the base gets smaller, the result gets more precise.

I want to understand how the logarithm processes each element of the polynomial to get the result.. The entire process, and not a rough approximation.

I made a program that composes the text of a Taylor series for log(1+x) with a polynomial with 10 terms, but the result is a text file with hundreds of Mb, so it is unreadable.

I understand that the largest term is approximately $n+log_b(a_n)$, but I want a more precise understanding. A rough explanation based on bounds is what I already know. I have no interest on that, unless it is part of the entire explanation.

1

There are 1 best solutions below

10
On

Let's consider the base $b=10$. Other bases are handled the same way.

If $N$ is a positive integer which has $p$ digits in base $10$, we have :

$$10^{p-1}\le N<10^p$$ Hence :

$$p-1\le\log_{10}(N)<p$$

This last condition is equivalent to :

$$p=\lfloor1+\log_{10}(N)\rfloor$$