I have the following question:
Show that $\displaystyle\sum_{k=1}^n a_k=na_n-\displaystyle\sum_{k=1}^{n-1} k(a_{k+1}-a_k)$
then evaluate $\displaystyle\sum_{k=1}^n \lfloor \log_2(k) \rfloor=(n+1)\lfloor \log_2(n) \rfloor -2^{\lfloor \log_2(n) \rfloor+1}+2$
I can show the first part pretty easily by induction but I have no idea where to go with the second part. I use the expansion and get:
$\displaystyle\sum_{k=1}^n \lfloor \log_2(k) \rfloor=n\lfloor \log_2(n) \rfloor-\displaystyle\sum_{k=1}^{n-1} k(\lfloor \log_2(k+1) \rfloor-\lfloor \log_2(k) \rfloor)$ but I have no idea where to go from here.
Thanks for any help.