Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

While evaluating the complexity of an algorithm, I got an inequality that I am unable to understand.

Let us consider this series:

$$x= n + (2^0 + 2^1 + 2^2 + ....... + 2^{\lfloor\log(n-1)\rfloor})$$

How do I prove that $x\leq 3n$ ?

Please help me understand this intuitively or otherwise.

share|cite|improve this question

The key is the identity $$ \sum_{i=0}^{m}2^{i} = 2^{m+1}-1 $$

Then just plugging in $m=\lfloor\log(n-1)\rfloor$ we get $$ x = n + (2^{\lfloor\log(n-1)\rfloor+1}-1) $$ It should be obvious from there.

share|cite|improve this answer

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.