Copyright by Dr. Marek A. Suchenek 2012,2013,2014
This material is intended for future publication.
Absolutely positively no copying no printing no sharing no distributing of ANY kind, please.

Clever computation of
(∑_(i=1)^n)⌊Log2[i]⌋
using experimental integration

Plot[{⌊Log2[x]⌋},{x,1,9.1},AxesOrigin-> {1,0},AspectRatio-> .3,PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∫_2^x)⌊Log2[y]⌋\[DifferentialD]y,(∑_(i=2)^(⌊x⌋-1))⌊Log2[i]⌋},{x,2,9.1}, AxesOrigin-> {1,0},AspectRatio-> .6,PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Thus for every integer x ≥2 , (∫_2^x)⌊Log2[y]⌋\[DifferentialD]y = (∑_(i=2)^(⌊x⌋-1))⌊Log2[i]⌋,
indeed.

1. Continuous solution

Since ⌊Log2[i]⌋is constant between consecutive powers of 2, symbolic computation of (∫_2^x)⌊Log2[y]⌋\[DifferentialD]y 
should be easy.

I am going to experimentally derive the following equalily:

(∑_(i=2)^(⌊x⌋-1))⌊Log2[i]⌋=x⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))(2^i)

Plot[{(∑_(i=2)^(⌊x⌋-1))⌊Log2[i]⌋,x⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))(2^i)},{x,1,20.1},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Since ∫c\[DifferentialD]x=c x + constant,

let's try this

⌊Log2[x]⌋x  as a first guess for (∫_2^x)⌊Log2[y]⌋\[DifferentialD]y

Plot[{(∑_(i=2)^(⌊x⌋-1))⌊Log2[i]⌋(*(∫_2^x)⌊Log2[y]⌋\[DifferentialD]y*),⌊Log2[x]⌋x},{x,1,20},AxesOrigin->{1,0},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

That was close, but not totally correct.

The crooked line (the top line) 
x⌊Log2[x]⌋ jumps up by x for every 
2≤ x=(2^(⌊Log2[x]⌋)). 

This is so because when (2^k)-1< x < (2^k) then 
⌊Log2[x]⌋=k-1 and x⌊Log2[x]⌋=x×(k-1), but when x = (2^k) then x⌊Log2[x]⌋=x×k
so that the jump at x = (2^k) is
 x×k - x×(k-1)=x.

For example, 
for x = 2 it jumps up by 2,
for x = 4 it jumps up by 4 (so the accumulated jump is 2+4=6), 
for x = 8 it jumps up by 8 (so the accumulated jump is 2+4+8=14), etc.

So, we need to subtract k from x⌊Log2[x]⌋ 
for every 2≤ k=(2^(⌊Log2[k]⌋))≤ x, that is, 
(by applying ⌊Log2[·]⌋ to all sides of the above inequality and substituting 
i = ⌊Log2[k]⌋ so that k =  (2^i) ),

subtract (2^i) from x⌊Log2[x]⌋ 
for every 1≤ i≤ ⌊Log2[x]⌋, that is, 

subtract (∑_(i=1)^(⌊Log2[x]⌋))(2^i)from x⌊Log2[x]⌋

Plot[{(∑_(i=1)^(⌊x⌋-1))⌊Log2[i]⌋,x⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))(2^i)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Bingo!

Now, we just simplify (∑_(i=1)^(⌊Log2[x]⌋))(2^i)

Plot[{(∑_(i=1)^(⌊x⌋-1))⌊Log2[i]⌋,x⌊Log2[x]⌋-((2^(⌊Log2[x]⌋+1))-2)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Thus

(∑_(i=1)^(⌊x⌋-1))⌊Log2[i]⌋=x⌊Log2[x]⌋-(2^(⌊Log2[x]⌋+1))+2

or putting x = n+1 so that ⌊x⌋-1 = n,

(∑_(i=1)^n)⌊Log2[i]⌋=(n+1)⌊Log2[n+1]⌋-(2^(⌊Log2[n+1]⌋+1))+2

This complete the experimental derivation of the above formula

The rest of this file is optional for all students

A different (optional) way of getting there

Plot[{(∑_(i=2)^(⌊x⌋))⌊Log2[i-1]⌋,x⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))(2^i)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋-1))⌊Log2[i]⌋,x⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))(2^i)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋-1))⌊Log2[i]⌋,x⌊Log2[x]⌋-((2^(⌊Log2[x]⌋+1))-2)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

2. Discontinuous solution

(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋=x⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))((2^i)-1)

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,x⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))((2^i)-1)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,x⌊Log2[x]⌋-((∑_(i=1)^(⌊Log2[x]⌋))(2^i)-⌊Log2[x]⌋)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,x⌊Log2[x]⌋-((2^(⌊Log2[x]⌋+1))-2-⌊Log2[x]⌋)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,x⌊Log2[x]⌋-(2^(⌊Log2[x]⌋+1))+2+⌊Log2[x]⌋},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,(x+1)⌊Log2[x]⌋-(2^(⌊Log2[x]⌋+1))+2},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Thus we proved

(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋=(x+1)⌊Log2[x]⌋-(2^(⌊Log2[x]⌋+1))+2

or putting x = n

(∑_(i=1)^n)⌊Log2[i]⌋=(n+1)⌊Log2[n]⌋-(2^(⌊Log2[n]⌋+1))+2

The continuous solution was

(∑_(i=1)^n)⌊Log2[i]⌋=(n+1)⌊Log2[n+1]⌋-(2^(⌊Log2[n+1]⌋+1))+2

Another way to derive discontinuous solution

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,(x+1)⌊Log2[x]⌋},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,(x+1)⌊Log2[x]⌋-(∑_(i=1)^(⌊Log2[x]⌋))(2^i)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]

Plot[{(∑_(i=1)^(⌊x⌋))⌊Log2[i]⌋,(x+1)⌊Log2[x]⌋-((2^(⌊Log2[x]⌋+1))-2)},{x,1,20},PlotPoints-> 200, PlotTheme->"Classic",PlotStyle->{Thickness[Medium]}]