A conjecture on integers coprime to $2^n-1$ and having a prescribed Hamming weight in their binary representation

57 Views Asked by At

I wonder if anyone has seen this before or would have some ideas on how to go about proving it. I have done several experiments with the computer and seems to hold.

For an integer $k$, denote by $W_2(k)$ the Hamming weight of the binary representation of $k$.

Conjecture: Let $n > 1$ and let $w \in \{1, 2, \ldots, n-1\}$. If $n$ is a power of $2$, further assume that $w \not \in \{2, n-2\}$. Then there exists an integer $i \in [1, 2^n-1]$ coprime to $2^n-1$ and such that $W_2(i) = w$.

An easy case to prove is the case when $\gcd(w,n) = 1$. Indeed, $2^w-1$ has weight $w$ and $\gcd(2^w-1, 2^n-1) = 2^{\gcd(w,n)} - 1 = 1$ satisfies the conjecture in this case.