Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
Coming off a coding stretch, it occurs to me you should specify that you're not in base 2 or 3. – Carl Witthoft Feb 22 '14 at 16:22
up vote 50 down vote accepted

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$.

share|cite|improve this answer

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.

share|cite|improve this answer
If $n=1$, $2^n+1=2$ is not odd. But it's still obviously not a power of ten. – aschepler Feb 22 '14 at 20:41
I believe you mean $n=0$, which is excluded by the problem statement. – vadim123 Feb 22 '14 at 20:42
oops, yes...... – aschepler Feb 22 '14 at 20:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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