This question already has an answer here:

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.


marked as duplicate by Simply Beautiful Art, Arthur, Rohan, TastyRomeo, Adam Hughes Feb 15 '17 at 15:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ @Simply Beautiful Art No. Your link only explains approximately what I said when I wrote $n+log_b(a_n)$. As I said, I want the complete process, not just an approximation. $\endgroup$ – xihocipi Feb 15 '17 at 12:28
  • $\begingroup$ It gives exactly how many digits a number has in a given base. What approximation do you mean? $\endgroup$ – Simply Beautiful Art Feb 15 '17 at 12:34
  • $\begingroup$ You didn't read the selected answer. $\endgroup$ – xihocipi Feb 15 '17 at 12:36
  • $\begingroup$ I see nothing wrong with the below answer. The digits themselves play absolutely no role in how many digits there are. Unless you more clearly state what's wrong with the below, I cannot help you. $\endgroup$ – Simply Beautiful Art Feb 15 '17 at 12:38
  • $\begingroup$ Of course the digits play a role in how many digits the number have. The encoding size in binary of 64 is larger than the encoding size of 16. I'm asking what the logarithm does to each element of the polynomial. $\endgroup$ – xihocipi Feb 15 '17 at 12:42

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 :


This last condition is equivalent to :


  • $\begingroup$ That is just what I wrote expressed in another way. It does not explains what the logarithm does with the polynomial, piece by piece. One difficulty is that there is not a closed form of $log(a+b)=f(log(a),log(b))$ $\endgroup$ – xihocipi Feb 15 '17 at 12:30
  • $\begingroup$ @xihocipi I only see some inequalities, the definition of logarithms, and silent use of monotonicity. There should be no more required to answer this question. $\endgroup$ – Simply Beautiful Art Feb 15 '17 at 12:40
  • $\begingroup$ @xihocipi it doesn't matter what $\log$ does with a sum. What matters is your number can be written as $N=\alpha\times 10^{p-1}$ for $1\leq \alpha<10$ and $\log(N)=\log(\alpha\times 10^{p-1})=\log(\alpha)+\log(10^{p-1})=p-1+\log(\alpha)$ --- and $\log(\alpha)<1$; i.e what matters is what $\log$ does to a product. $\endgroup$ – JP McCarthy Feb 15 '17 at 13:11
  • $\begingroup$ You are just trowing away $log(\alpha)$ under the carpet, and there is the meat of the problem. $\endgroup$ – xihocipi Feb 15 '17 at 13:21
  • $\begingroup$ I said that I composed a polynomial with a taylor series, to examine what is the result, and you discard all that hard work as it were non relevant. $\endgroup$ – xihocipi Feb 15 '17 at 13:23

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