3. Evaluate the sum
$$
\sum_{n=1}^{6237}\left\lfloor\log _{2}(n)\right\rfloor
$$
where $|x|$ denotes the greatest integer less than or equal to $x$.
3. Answer: 66666.
Note that $\left\lfloor\log _{2}(1)\right\rfloor=0$, and $\left\lfloor\log _{2}(n)\right\rfloor=k$ if $2^{k} \leq n<2^{k+1}$. Since $6237=2^{12}+2141$. we have $\left\lfloor\log _{2}(n)\right\rfloor=12$ for $2^{12} \leq n \leq 6237$, and there are 2142 such $n^{\prime}$ s. Thus
$$
\begin{aligned}
\sum_{n=1}^{6237}\left\lfloor\log _{2}(n)\right\rfloor & =0+1\left(2^{2}-2\right)+2\left(2^{3}-2^{2}\right)+\cdots+11\left(2^{12}-2^{11}\right)+(12)(2142) \\
& =(11) 2^{12}-\left(2+2^{2}+\cdots+2^{11}\right)+(12)(2142) \\
& =(11) 2^{12}-2\left(2^{11}-1\right)+(12)(2142) \\
& =(20) 2^{11}+(12)(2142)+2=66666
\end{aligned}
$$