How do I prove $2^0 + 2^1 + 2^2 + 2^3 +\cdots + 2^{d-1} \le n - 1$ $\space$ if $\space$ $d = \lfloor \log_2 n \rfloor$? I was given this inequality in university, me and my friends can't solve it, hope someone here can explain me:
$2^0 + 2^1 + 2^2 + 2^3 + \cdots + 2^{d-1} \le n - 1$ $\space$ if $\space$ $d = \lfloor \log_2 n \rfloor$.

Observe that the series $\sum_{k=0}^d 2^k$ is a geometric series which has the closed form $(2^{d}-1)/(2-1) = 2^{d}-1$.
Because $d = \lfloor \log_2n \rfloor$, we have
$$d = \lfloor \log_2n \rfloor \leq \log_2n$$
by definition of the floor function. Raising both sides of the inequality by 2 and subtracting 1 thereafter, we deduce that
$$2^d - 1 \leq 2^{\log_2n} - 1 = n -1 $$ 
as desired.
