0

So I'm trying to come up with a solution to this task: Each natural number x greater than 1 has log x digits. Is this true? And if it isn't, what would be the correct answer?

After plugging several numbers as "x" I'm assuming there is in fact a mistake, I however don't know what's the right answer to this task.

khand
  • 45

3 Answers3

0

The idea is in the right direction, but has a number of flaws in detail.

First, for positive integers $n$, $\log n$ will only rarely be an integer, and the answer you want is clearly an integer.

Second, there is the question of the base of the logarithms you are using. For decimals you need base $10$.

Now for how to get it right. If $n$ has $r$ digits in base $10$ we have $$10^r\gt n \ge 10^{r-1}$$ ($10^r$ is the least integer with $r+1$ digits) and taking logs to base $10$ gives us $$r\gt \log_{10}n\ge r-1$$So what we need to do is to take the integer part of $\log_{10}n$, which is $r-1$ and add $1$.

The formula becomes $r=\lfloor\log_{10}n\rfloor +1$

The number of digits in base $b$ is likewise $r=\lfloor\log_{b}n\rfloor +1$

Mark Bennet
  • 100,194
0

Issues to consider:

(a) the logarithm has to be in the correct base, i.e. you have to use $\log_{b}$, which for $b=10$ is common logarithms $\log_{10}$ rather than natural logarithms $\log_e$

(b) this almost gives the correct answer, though with a couple of adjustments:

  • For numbers which are not powers of the base you need to round the logarithm up to the next integer
  • For numbers which are powers of the base you need to add $1$ to the logarithm

So for example

  • $3456$ has four decimal digits and $\log_{10}(3456) \approx 3.5386$
  • $1000$ has four decimal digits and $\log_{10}(1000) = 3$

You could say the number of base $b$ digits of $n$ is $$1+\lfloor \log_b(n) \rfloor$$

Henry
  • 157,058
0

The number of digits in a number $N$ is given by one more than than the integer part of $\log_{10} N .$ We know that $\log_{10} 2 = 0.3010, \log_{10} 3 = 0.4771, \log_{10} 5=.6989$.

No of digits in $2^5$ is 2 which is one more than integer part of $\log_{10}2^5=5\times 0.3010 =1.5050$

Similarly no of digits in $2^{10}$ are 4 which is one more than integer part of $\log_{10}{2^{10}}=3.010$.

Z Ahmed
  • 43,235