$$\sum_{i=0}^{lg(n)} 2^i = (2n + 1)$$
Where lg is the base 2 logarithm.
Why? Is there a name for this summation?
$$\sum_{i=0}^{lg(n)} 2^i = (2n + 1)$$
Where lg is the base 2 logarithm.
Why? Is there a name for this summation?
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$$