if $d|n$, then $S_2(d) \leq S_2(n)$? For every positive integer $n$, denote $S_2(n)$ the sum of digits of $n$ in binary form (for example, $S_2(42) =S_2(101010_2)=3$ 
Is it true that if $(2^k-1)|n$, then $S_2(2^k-1) \leq S_2(n)$ ? If not, what are the conditions of $k$ so that $S_2(2^k-1) \leq S_2(n)$ ?
 A: Claim: For natural numbers $k$ and $b>1$, suppose that $b^k-1$ divides a natural number $n$.  Then, $$(b-1)k=S_b(b^k-1)\leq S_b(n)\,,$$ where $S_b(m)$ denotes the sum of all $b$-ary digits of $m\in\mathbb{N}$ (when $m$ is expressed in the base-$b$ representation).
For each $m\in\mathbb{N}$, let $r(m)$ denote the largest natural number $r$ such that $b^r\leq m$.  Define 
$$f_b(m)=\begin{cases}m&\text{if}\ r(m)<k\\m-b^{r(m)-k}(b^k-1)&\text{if}\ r(m)\geq k.\end{cases}$$  Observe that $$S_b\big(f_b(m)\big)\leq S_b(m).$$
Let $f_b^t$ be the $t$-time iteration of $f_b$.  We see that $f^t_b(m)$ stabilizes at some $t\geq t_0$ ($t_0$ depends on $m$), with $$F(m)=f^{t_0}_b(m)=f^{t_0+1}_b(m)=f^{t_0+2}_b(m)=\ldots$$ being a natural number less than or equal to $b^k-1$.  If $b^k-1$ divides a given natural number $n$, then $F(n)$ must equal $b^k-1$.  Hence,
$$S_b(n)\geq S_b\big(f_b(n)\big)\geq S_b\big(f_b^2(n)\big)\geq \ldots \geq S_b\big(f_b^{\tau_0}(n)\big)=S_b\big(F(n)\big)=S_b(b^k-1)=(b-1)k$$
if $f_b^t(n)$ stabilizes for $t\geq \tau_0$.
