Amortized analysis for doubling resizing array is ~3n
Note that the statement involves two variables $i$ and $n$. The sum of powers of two equals the next power minus one: $\sum_{k=0}^i 2^k = 2^{i+1}-1$. It is mentioned that $2^i$ is the largest power less than $n$. That means $2^i &lt; n \le 2^{i+1}$.  

As $2^i &lt; n$ we have that the sum $2\cdot 2^i -1$ is less than $2n-1$.

I am a little confused as the text states "at most" rather than "less than".