Finding all positive integers $n$ such that $\left \lfloor{\frac{2^n}{n}}\right \rfloor$ is a power of $2$. I am trying to figure out a question I have, I don't really know where to start. The question would be

Find all positive integers $n$ such that $\displaystyle \left \lfloor{\frac{2^n}{n}}\right \rfloor$ is a power of $2$.

I don't have many ideas on how to tackle this problem, so I don't really have much to give.
One idea was to find the largest $k$ such that $2^{n-k} \geq n$ and deriving some properties from that.
 A: Given an integer $n$, by long division there are uniquely determined integers $q_n$ and $r_n$ with $0\leq r_n<n$ such that
$$2^n=q_n\cdot n+r_n.$$
Then $\lfloor\tfrac{2^n}{n}\rfloor=q_n$.
First, if $r_n=0$ then $q_n$ divides $2^n$ and so $q_n$ is a power of $2$. In this case $n$ also divides $2^n$, so $n$ is also a power of $2$. Conversely, if $n$ is a power of $2$, say $n=2^k$, then clearly $$\lfloor\frac{2^n}{n}\rfloor=2^{2^k-k}$$ is a power of $2$.
Next, if $r_n>0$ and $q_n$ is a power of $2$, say $q_n=2^m$ for some nonnegative integer $m$, then
$$2^n=2^m\cdot n+r_n.$$
Clearly $2^m\leq2^n$ and so $2^m$ also divides $r_n$. Then from $r_n<n$ it follows that $2^m<n$ and hence
$$2^n=2^m\cdot n+r_n<n^2+n.$$
Of course the left hand side grows faster than the right hand side, so this is only possible for small values of $n$; already for $n=5$ we see that $2^5>5^2+5$, so $n\leq4$. The values $n=1,2,4$ are powers of $2$ and so we just need to check for $n=3$ that
$$\lfloor\frac{2^3}{3}\rfloor=\lfloor\frac{8}{3}\rfloor=2,$$
is also a power of $2$.
A: The trivial solutions are n=2^k. The only other possible solutions might be n = 2^k - 1; and n = 3 is indeed a solution; 2^3 / 3 = 2 + 2/3, rounded down to a power of two. n=7 doesn’t work; 128/7 = 16 + 16/7 which is too far from a power of two.
