Proving ⌊n⌋ series is O(n)

33 Views Asked by At

I have this problem:

Let ⌊n⌋ be the largest power of 2 less than or equal to n. Prove that 1 + 2 + 4 + 8 + ... +⌊n⌋=O(n)

The series can also be written as this (?): 1 + 2 + 4 + 8 + ... + $2^{ \log_2 n} $

Wouldn't that then make the series 1 + 2 + 4 + 8 + ... + n which is not O(n)? I can't wrap my head around this.