Parity of $\sum_{i=1}^{n}\lfloor \log_2(i) \rfloor$ Let, $L=\sum_{i=1}^{n}\lfloor \log_2(i) \rfloor $.
Problem: Find $n$ for which $L$ is odd. In other words, find a closed form expression (function)  $f(n)$of variable $n$ such that $L$ is odd/even if and only if  $f(n)$ is odd/even.
Example: $L$ is odd if and only if  $f(n)=n^2-1$ (an example, this is not true) is odd. $L$ is even if and only if  $f(n)=n^2-1$ (an example, this is not true) is even.
Motivation: I am trying to verify a number theoretic function in an alternative way.
 A: Define $g(x) = \sum_{i=1}^{x}\lfloor \log_2(i) \rfloor$

Lemma 1.  $\lfloor \log_2(x) \rfloor$ is invariant with $ x $ changing until $x$ is a exponent of $2$.


Proof. since $2^{\lfloor \log_2(x) \rfloor}\leq 2^{\log_2(x)} \leq 2^{\lfloor \log_2(x) \rfloor+1}$
So when $x = 2^k$ the equation holds, so Lemma 1 got proved. 


Lemma 2. If $\lfloor \log_2(x) \rfloor$ is even then $g(x)$ must be even.


Proof. By induction, $k = 2^{log_2(x)}$ if k is an integer  then, by Lemma 1. $g(x) = 0+1\times 2+2\times 4 + 3\times 8 +...+(k-1)2^{k-1}+x =g(2^{k-2})+(k-1)2^{k-1}+x  $ is an even integer. If k is a decimal number, I give one as an exercise. 


Lemma 3. If $g(x)$ is odd then $\lfloor \log_2(x) \rfloor$ must be odd.


Proof. exercise.

Lemma 4. If $g(x)$ is odd then $( {n-2^{\lfloor \log_2(n) \rfloor}-1})$ must be odd.

Proof. Note that when $k = 2^{log_2(x)}$ is an odd integer, it is the first change for the parity. So when add $\lfloor \log_2(x) \rfloor$ to sum, the parity must falters. Qed.
In a nut shell, $f(x)$ = $\lfloor \log_2(x) \rfloor\times( {n-2^{\lfloor \log_2(n) \rfloor}-1})$
EDIT: To give who pose this problem a more intuitive result, one can search this link to attest my statement is right or wrong.
