0

Prove that $\lceil \log(n) \rceil $ equals the number of digits of $n \ne 10^a$ for some non-negative integer $a$

Let for some positive integer $k$ and non-negative integers $a_i<10$, $i \in \{0,1,2,\dots,k\}$ $$n=10^ka_k+10^{k-1}a_{k-1}+\dots+10a_1+a_0<10^{k+1} \implies \log(n)<k+1$$ $$10^k a_k +10^{k-1}a_{k-1}+\dots+10a_1+a_0\ge 10^k \implies \log(n)\ge k$$ Thus $\lceil \log(n) \rceil =k+1$.

My main question is: Is there another proof?

Is this proof right?

Anas A. Ibrahim
  • 1,884
  • 7
  • 15
  • $k \le W < k+1$ doesn't mean $\lceil W\rceil = k+1$. It means $\lfloor W \rfloor = k$. – fleablood Jun 09 '20 at 14:58
  • An open problem is a known problem which can be accurately stated, and which is assumed to have an objective and verifiable solution, but which has not yet been solved (i.e., no solution for it is known). – J. W. Tanner Jun 09 '20 at 15:03
  • There's always another proof. But core should be $N$ having $m$ digits means $10^{m-1} \le N < 10^m$ (although depending on your audience you may need to spell that out [oh, and you do need to point out $ak\ne 0$]) so $m-1 \le \log N < m$ so $m=\lfloor N \rfloor + 1$. – fleablood Jun 09 '20 at 15:03
  • @J.W.Tanner Oh, sorry, I meant that everyone can post their solutions and try their best at it. – Anas A. Ibrahim Jun 09 '20 at 19:47

1 Answers1

1

Your proof seems a little bare to me. If I didn't already know the proof, I would struggle to follow your reasoning here. Also, the claim is not quite true, specifically if $n$ is a power of $10$. For example, $\log_{10}(100) = 2$, but $100$ has $3$ digits. Instead, it really should be $\lfloor \log_{10}(n) \rfloor + 1$.

The heart and soul of the proof is, a number with $k$ digits lies between $10^{k-1}$ and $10^k$, including the former, excluding the latter. A number $n$ with $k$ digits takes the form $$n = a_{k-1}10^{k-1} + a_{k-2}10^{k-2} + \ldots + 10a_1 + a_0,$$ where $a_0, \ldots, a_{k-1} \in \{0, \ldots, 9\}$, and $a_{k-1} \neq 0$ (otherwise $n$ would have at most $k - 1$ digits). Since each power of $10$ is positive, we obtain a lower bound $$n \ge 1 \cdot 10^{k - 1} + 0 \cdot 10^{k - 2} + \ldots + 0 \cdot 10 + 0 = 10^{k - 1},$$ and an upper bound $$n \le 9 \cdot 10^{k - 1} + 9 \cdot 10^{k - 2} + \ldots + 9 \cdot 10 + 9 = 10^k - 1 < 10^k.$$ That is, $10^{k - 1} \le n < 10^k$, and since $\log_{10}$ is strictly increasing, $$k - 1 = \log_{10} (10^{k - 1}) \le \log_{10}(n) < \log_{10}(10^k) = k.$$ This implies that $\lfloor \log_{10}(n) \rfloor = k - 1$, so $k$, the number of digits, is $\lfloor \log_{10}(n) \rfloor + 1$.

  • 1
    Sorry, I missed the condition that $n$ is not a power of $10$. In this case, the ceiling formula works too; since $\log_{10}(n)$ is never an integer, so $\lceil \log_{10}(n) \rceil = \lfloor \log_{10}(n) \rfloor + 1$. – user797616 Jun 09 '20 at 14:56
  • Why do you say "since $\log_{10}n$ is never an integer"? Of course, $\log_{10} n$ can be an integer. – fleablood Jun 09 '20 at 15:05
  • @fleablood In the title, there is a restriction on $n$, specifically $n \neq 10^a$ (presumably for all non-negative integers $a$). – user797616 Jun 09 '20 at 15:06