16
$\begingroup$

I want to show that for $n>0$, $2^n$ and $2^n + 1$ have the same number of digits.

What I did was I found that the formula for the number of digits of a number $x$ is $\left \lfloor{\log_{10}(x)}\right \rfloor + 1$, so basically if I subtract that formula with $x = 2^n$ with the formula with $x = 2^n + 1$, I should get zero.

$\left \lfloor{\log_{10}(2^n)}\right \rfloor + 1 - (\left \lfloor{\log_{10}(2^n + 1)}\right \rfloor + 1) = \left \lfloor{\log_{10}(2^n)}\right \rfloor -\left \lfloor{\log_{10}(2^n + 1)}\right \rfloor $.

At this point, I don't know of a way to simplify this any further to make it equal $0$. I thought about mentioning that $\log_{10}(x)$ increases slower than $x$ as $x$ increases, which would mean the difference of the floor of the logs of two consecutive numbers may be close to zero, but that doesn't cut it to prove that $2^n, 2^n + 1$ have exactly the same number of digits.

Are there any special floor or log properties I could use to make this easier? Any help is appreciated.

$\endgroup$
1
  • 1
    $\begingroup$ Coming off a coding stretch, it occurs to me you should specify that you're not in base 2 or 3. $\endgroup$ Feb 22, 2014 at 16:22

2 Answers 2

53
$\begingroup$

Note the only way $2^n+1$ can have one more digit than $2^n$ is if $2^n$ ended in a $9$ (actually ends is $\cdots 999999$ but that is not important). $2^n$ can never end in a $9$.

$\endgroup$
43
$\begingroup$

In order for them to have a different number of digits, $2^n+1$ must be exactly a power of 10. But that's impossible, since $2^n+1$ is odd.

$\endgroup$
2
  • $\begingroup$ If $n=1$, $2^n+1=2$ is not odd. But it's still obviously not a power of ten. $\endgroup$
    – aschepler
    Feb 22, 2014 at 20:41
  • 4
    $\begingroup$ I believe you mean $n=0$, which is excluded by the problem statement. $\endgroup$
    – vadim123
    Feb 22, 2014 at 20:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .