Double sum related to the binary expansion of $n$

54 Views Asked by At

Let $$\ell(n)=\left\lfloor\log_{2}(n)\right\rfloor$$ and $$T(n,k)=\left\lfloor\frac{n}{2^k}\right\rfloor\operatorname{mod}2$$ Here $T(n,k)$ is the $(k+1)$-th bit from the right side in binary expansion of $n$.

Then we have an integer sequence given by $$a(n)=\sum\limits_{k=0}^{\ell(n)}\sum\limits_{j=0}^{\ell(n)-k}(-1)^{k}(j+1)T(n,j+k)$$ The sequence begins with $$1, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 5, 6, 3, 4, 4, 5, 5$$

Let $b(n)$ be A001511, the ruler function: $2^{b(n)}$ divides $2n$. Or, $b(n) = 2$-adic valuation of $2n$.

Let $$c(n)=\left\lfloor\frac{(n+2)^2}{4}\right\rfloor$$

Let $d(n)=c(b(n))$.

Let $$e(n)=\begin{cases} d(\frac{n}{4}),&\text{if $n\operatorname{mod}4=0$;}\\ 1,&\text{otherwise.} \end{cases}$$

Let $$f(n)=\sum\limits_{k=0}^{n-1}e(k), f(1)=0$$

I conjecture that $$a(n)=n-f(\left\lfloor\frac{n}{2}\right\rfloor+1)$$

Is there a way to prove it?