# Find $n$ satisfying the equation $[\log_21]+[\log_22]+[\log_23]+\dots[\log_2n]=1538$

If $[\cdot]$ denotes greatest integer function, then what is the value of natural number $n$ satisfying the equation $$[\log_21]+[\log_22]+[\log_23]+\dots[\log_2n]=1538 ?$$

My try:

Note that $$0+1\times2+2\times2^2+3\times2^3+4\times2^4+5\times2^5+6\times2^6+7\times2^7=1538$$

But the answer is $$n=\sum_{i=0}^72^i=255.$$

How is it derived?

-
Your first displayed line is a proof that the answer is correct. – André Nicolas Mar 8 '14 at 7:24
I think the OP means that, from what he wrote, the answer would come more naturally in the form $2^8-1$, the last value taken by $n$ in the sum. – alex Mar 8 '14 at 7:29
@Sush: You need the $2^7$ copies of numbers that give you a floor of $7$, so you need the numbers from $128$ to $255$. – André Nicolas Mar 8 '14 at 7:59

For all $j$ such that $2^k\leq j<2^{k+1}$ for some integer $k$, we have $[\log j]=k$. Further note that there are exactly $2^k$ $j$s that $[\log[j]=k$ holds. Hence from $$0+1×2+2×2^2+3×2^3+4×2^4+5×2^5+6×2^6+7×2^7=1538$$, we can easily obtain $$\left([\log_21]\right)+\left([\log_22]+[\log_23]\right)+\cdots+\left([\log_2(2^7)+\cdots+\log_2(2^8-1)]\right)=1538$$
$$n=\sum_{i=0}^72^ii=1538$$