How to find cases where $m^2$ is near to $2^A$?

79 Views Asked by At

In another problem here in MSE I ran into the question how I can (practically, in a program) find (positive) integer $m$ such that they are "near" to perfect powers of $2$, so $$ (0 \lt ) \qquad d_m = 2^{A_m} - m^2 \qquad \qquad \text{ is "small"} $$ where $A$ can be determined from $$ A = \lceil 2 \log_2(m) \rceil $$ [update] here the parameter $m$ is assumed to be odd. [/update]

With the problem of finding $N$ such that $2^S - 3^N$ is "small" I know I can find the combinations $N$ and $S$ using the continued fraction of $\log_2(3)$ but I don't know how I can modify this idea for this case where $m$ is variable and its exponent is fixed.

Examples by brute-force search and a certain "sufficient small" criterion are $ m \in \{11, 45, 181, 11585, 741455\} $ when I searched odd numbers $m$ from $3 \le m \le 9999999$ using Pari/GP; but to find substantially higher $m$ something like continued fractions should be used.

Question: Which method could help find cases $m$ where the differences $d_m = 2^{A_m} - m^2$ are (relatively) small?

1

There are 1 best solutions below

3
On BEST ANSWER

You want to find out when $m$ is close to $2^{n/2}$. If $n$ is even then $m = 2^{n/2}$ is the best you can do, and the next best are $2^{n/2} \pm 1$. If $n$ is odd then the best you can do is $m = \lceil 2^{n/2} \rceil$ or $m = \lfloor 2^{n/2} \rfloor$. Now the interesting question is how close $m$ can get to $\sqrt{2}$ times a power of $2$, and this is a matter of examining the binary expansion of $\sqrt{2}$ and hoping for long sequences of $0$s or something like that.