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

First, remember that
$$
\sum_{i=0}^{n-1}ar^i=a\frac{1-r^n}{1-r}, \qquad r\neq 1.
$$
So, in particular,
$$
1+2+2^2+\cdots+2^{d-1}=\frac{1-2^d}{1-2}=2^d-1.
$$
