<s>[INST] 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.
 [/INST] 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$.
</s>