Why does (Sum from i=0 to lg(n) of 2^j) = (2n+1)?

330 Views Asked by At

$$\sum_{i=0}^{lg(n)} 2^i = (2n + 1)$$

Where lg is the base 2 logarithm.

Why? Is there a name for this summation?

1

There are 1 best solutions below

0
On BEST ANSWER

It's a trivial sum. It's basically

$$\sum_{i = 0}^n\ 2^i = 2^{n+1} - 1$$

With the difference that instead of $n$ you the $\log_2(n)$.

Hence

$$2^{\log_2(n) + 1} - 1 = 2\cdot 2^{\log_2(n)} - 1 = 2n-1$$