TITLE: Unexpected result, does $\Big\lfloor\frac{n-1}{2}\Big\rfloor=\sum_{i=1}^\infty\bigg\lfloor\frac{n+2^i-1}{2^{i+1}}\bigg\rfloor $
QUESTION [5 upvotes]: While trying to prove something else, I arrived at the result that for $n\in\Bbb{Z}^+$
$$\Big\lfloor\frac{n-1}{2}\Big\rfloor=\Big\lfloor\frac{n+1}{4}\Big\rfloor+\Big\lfloor\frac{n+3}{8}\Big\rfloor+\Big\lfloor\frac{n+7}{16}\Big\rfloor+\cdots=\sum_{i=1}^\infty\bigg\lfloor\frac{n+2^i-1}{2^{i+1}}\bigg\rfloor$$
This result was quite spectacular to me and I want to know if it is true and if it is how I can prove it. For all cases I've tried it seems to hold true.

REPLY [4 votes]: The following claim: 
$$\tag1\sum_{i=0}^\infty\bigg\lfloor\frac{n+2^i-1}{2^{i+1}}\bigg\rfloor=1 $$
clearly holds for $n=1$.
We have
$$ \sum_{i=0}^\infty\left(\left\lfloor \frac{n+2^i}{2^{i+1}}\right\rfloor-\left\lfloor \frac{n+2^i-1}{2^{i+1}}\right\rfloor\right)=\sum_{i\ge0\atop 2^{i+1}\mid n+2^i}1=\sum_{i\ge0\atop2^i\|n}1=1$$
because there is exactly one $i\ge0$ such that $2^i\|n$. Hence by induction $(1)$ holds for all $n$.
As one also verifies
$$\left\lfloor\frac{n-1}2\right\rfloor+\left\lfloor\frac{n}2\right\rfloor =n$$
(e.g., by case distinction whether $n=2m$ or $n=2m+1$), your result follows.