Show $n=1+\sum_{k=1}^{n}\left\lfloor{\log_2\frac{2n-1}{2k-1}}\right\rfloor$ for every natural number $n$.

combinatorial-proofselementary-number-theorylogarithmsnatural numberssummation

While answering a question here I noticed that:

$$n=1+\sum_{k=1}^{n}{\left\lfloor{\log_2\frac{2n-1}{2k-1}}\right\rfloor}$$

for every natural number $n$.

I tried to demonstrate it using Legendre's formula (alternate form), like in the answer mentioned above, but without success.

Anyone can help?

Best Answer

A Combinatorial Proof:

We are going to count the number of even numbers in the interval $[1,2n-1]$ in two different methods.

Counting in method 1: There are exactly $n-1$ even numbers in the interval $[1,2n-1]$ namely $2,4,\ldots,2n-2$.

Counting in method 2: Note that every even number can be represented as $2^am$ where $a\geq1$ and $m$ is odd. Clearly even numbers which are less than $2n-1$ must have odd parts less than $2n-1$. Let $N_k$ denote the number of even numbers in the interval $[1,2n-1]$ which have odd part $2k-1$. Therefore $$n-1=\sum_{k=1}^{n}N_k\tag{1}$$ Clearly $N_k$ is the largest integer $l$ such that $2^l(2k-1)\leq2n-1$ or equivalently $$N_k=\left\lfloor\mathrm{log}_2\frac{2n-1}{2k-1}\right\rfloor$$ Therefore we get from $(1)$, $$n-1=\sum_{k=1}^{n}\left\lfloor\mathrm{log}_2\frac{2n-1}{2k-1}\right\rfloor\\\implies n=1+\sum_{k=1}^{n}\left\lfloor\mathrm{log}_2\frac{2n-1}{2k-1}\right\rfloor$$

Related Question