4

Let $n \ge 1$ be an odd natural number. Define $$f(n)=\min \{\,\, |k| \,\,\, | \, k+2^n \,\,\,\text{is a square}\,\,,k \in \mathbb{Z}\}.$$

That is $f(n)$ measures how close is the power $2^n$ to a perfect square.

I guess that this notion was studied somewhere, but I couldn't find it naively on google.

Question: (a bit soft)

Does this function has a known name in the literature? Has it been studied somewhere? Is there a closed form formula for it, or at least some nice lower bounds on its values?

Asaf Shachar
  • 25,967
  • 1
    This is A238454...easy to compute but I don't see any obvious connections to familiar sequences. – lulu Mar 05 '22 at 19:34
  • @lulu This is not exactly A238454, which lists the next larger square. OP asks for the closest square for $k \in \mathbb Z$, reporting $f(n)=|k|$. So for $n=7$, A238454 lists $16$, being $144-128$. But $121-128$ gives $k=-7, |k|=7$ – Keith Backman Mar 05 '22 at 22:55
  • @KeithBackman Ah, thank you. I misread and only considered the larger. – lulu Mar 05 '22 at 22:57
  • @lulu - better to take absolute values from http://oeis.org/A236564 – Gottfried Helms May 02 '22 at 07:32

3 Answers3

11

Ineffectively, one can show that, given $\epsilon > 0$, there exists a positive constant $c(\epsilon)$ such that $$ f(n) \geq c(\epsilon) \, 2^{(1/2-\epsilon)n}. $$ This follows from the $p$-adic version of Roth's theorem, proved by Ridout, and represents the true state of affairs. I suspect that making this effective would be very hard and anything resembling a closed form is too much to hope for.

In terms of explicit lower bounds, one can prove that $$ f(n) > 2^{0.26n}, $$ unless $n \in \{ 3, 15 \}$. This can be found in an old paper of Bauer et al; the proof uses Pade approximation to the binomial function. It is unlikely that one can get much of a bound via elementary methods.

Mike Bennett
  • 3,614
  • 13
  • 12
1

There is Catalan’s conjecture and Michailescu’s theorem which states that $Y^p = 1 + X^q$ has only one solution for $X,Y >0$. Those numbers are $3^2= 1 + 2^3$. Since $2^{2n+1}$ cannot be a perfect square, $0$ cannot be a solution to $k$, which leaves $k=1$, as above as the nearest solution in absolute terms. I suppose in relative terms there will be plenty of odd powers of $2$ such that $ \mid 2^{2n+1}/ Y^p \mid \lt 9/8 = 1 \pm \varepsilon$ where higher and higher odd powers of $2$ reduces $\varepsilon$ to an arbitrarily low number.

1

In considering possible distance $k$ between an odd power of $2$ and the nearest integer square (see A236564), it may help to view the question more generally and first note some impossibilities.

For an odd $nth$ power of $2$, $2^n\equiv 2\pmod 3$. But for any integer $m$, $m^2\equiv 1$ or $0 \pmod 3$. Hence $3$ cannot divide$$|2^n-m^2|$$

Likewise, since odd powers of $2\equiv 2$, $3\pmod 5$, but $m^2\equiv 1$, $4$, $0\pmod 5$, then $5$ will not divide $$|2^n-m^2|$$

But since $2^n\equiv 2,1,4\pmod 7$, while $m^2\equiv 1,4,2,0\pmod7$, then $7$ will divide $|2^n-m^2|$ whenever $$2^n\equiv m^2\pmod7$$ E.g. $$2^7\equiv 11^2\equiv 2\pmod7$$After $1$ and $4$, then, $7$ is the closest an integer square can be to an odd power of $2$.

The same method reveals that neither $11$ nor $13$ divides$$|2^n-m^2|$$since$$2^n\equiv 2,8,10,7,6\pmod{11}$$but$$m^2\equiv 1,4,5,9,3,0 \pmod{11}$$And again,$$2^n\equiv 2,8,6,11,5,7\pmod{13}$$but$$m^2\equiv 1,4,9,3,12,10,0\pmod{13}$$But since$$2^n\equiv 2,8,15,9\pmod{17}$$and$$m^2\equiv 1,4,9,16,8,2,15,13,0\pmod{17}$$then $17$ will divide $|2^n-m^2|$ whenever$$2^n\equiv m^2\pmod{17}$$e.g.$$2^9\equiv 23^2\equiv 2\pmod{17}$$ Similarly, $19$ can be ruled out, and $23$ is the next smallest odd prime between $2^n$ and $m^2$:$$2^{11}\equiv 45^2\equiv 1\pmod{23}$$

In the following array, $2^n$ lies between consecutive integer squares $m^2$, $(m+1)^2$, with $k_m=2^n-m^2$, $k_{m+1}=(m+1)^2-2^n$. The lesser $k$ for each $2^n$ is in bold.

\begin{array}{rclcr} m^2 & k_m & 2^n & k_{(m+1)} & (m+1)^2\\ \hline 1^2 & \mathbf1 & 2^1 & 2 & 2^2\\ 2^2 & 2^2 & 2^3 & \mathbf1 & 3^2\\ 5^2 & 7 & 2^5 & \mathbf{2^2} & 6^2\\ 11^2 & \mathbf7 & 2^7 & 2^4 & 12^2\\ 22^2 & 2^2\cdot7 & 2^9 & \mathbf{17} & 23^2\\ 45^2 & \mathbf{23} & 2^{11} & 2^2\cdot17 & 46^2\\ 90^2 & 2^2\cdot23 & 2^{13} & \mathbf{89} & 91^2\\ 181^2 & \mathbf{7} & 2^{15} & 2^2\cdot89 & 182^2\\ 362^2 & \mathbf{2^2\cdot7} & 2^{17} & 17\cdot41 & 363^2\\ 724^2 & \mathbf{2^4\cdot7} & 2^{19} & 17\cdot191 & 725^2\\ 1448^2 & \mathbf{2^6\cdot7} & 2^{21} & 31\cdot79 & 1449^2\\ 2896^2 & \mathbf{2^8\cdot7} & 2^{23} & 4001 & 2897^2\\ 5792^2 & 2^{10}\cdot7 & 2^{25} & \mathbf{7\cdot631} & 5793^2\\ 11585^2 & \mathbf{5503} & 2^{27} & 2^2\cdot7\cdot631 & 11586^2\\ 23170^2 & \mathbf{2^2\cdot5503} & 2^{29} & 24329 & 23171^2\\ 46340^2 & 2^4\cdot5503 & 2^{31} & \mathbf{41\cdot113} & 46341^2\\ 92681^2 & 7\cdot23833 & 2^{33} & \mathbf{2^2\cdot41\cdot113} & 92682^2\\ 185363^2 & 17\cdot73\cdot239 & 2^{35} & \mathbf{2^4\cdot41\cdot113} & 185364^2\\ 370727^2 & 31^2\cdot463 & 2^{37} & \mathbf{2^6\cdot41\cdot113} & 370728^2\\ 741455^2 & \mathbf{7\cdot42409} & 2^{39} & 2^8\cdot41\cdot113 & 741456^2\\ 1482910^2 & \mathbf{2^2\cdot7\cdot42409} & 2^{41} & 79\cdot22511 & 1482911^2\\ 2965820^2 & 2^4\cdot7\cdot42409 & 2^{43} & \mathbf{761\cdot1553} & 2965821^2\\ 5931641^2 & 191\cdot37361 & 2^{45} & \mathbf{2^2\cdot761\cdot1553} & 5931642^2\\ 11863283^2 & \mathbf{7^2\cdot17\cdot5783} & 2^{47} & 2^4\cdot761\cdot1553 & 11863284^2\\ 23726566^2 & \mathbf{2^2\cdot7^2\cdot17\cdot5783} & 2^{49} & 7\cdot23\cdot31\cdot5647 & 23726567^2\\47453132^2 & 2^4\cdot7^2\cdot17\cdot5783 & 2^{51} & \mathbf{17830441} & 47453133^2\\94906265^2 & {118490767} & 2^{53} & \mathbf{2^2\cdot17830441} & 94906266^2\\189812531^2 & \mathbf{41\cdot2300927} & 2^{55} & 2^4\cdot17830441 & 189812532^2\\379625062^2 & \mathbf{2^2\cdot41\cdot2300927} & 2^{57} & 7\cdot359\cdot151969 & 379625063^2\\759250124^2 & 2^4\cdot41\cdot2300927 & 2^{59} & \mathbf{9092137} & 759250125^2\\1518500249^2 & 47\cdot137\cdot466009 & 2^{61} & \mathbf{2^2\cdot9092137} & 1518500250^2\\ \end{array}

For $n\le61$, $k$ is composed only of even powers of $2$ (since $1=2^0$) and primes $p\equiv \{1, 2 ,7\}\pmod{8}$: $$2, \,7, \,17, \,23, \,31, \,41, \,47, \,73, \,79, \,89, \,113, \,137, \,191, \,239, \,359, \,463, \,631, \,761, \,1553,\\ 4001, \,5503, \,5647, \,5783, \,22511, \,23833, \,24329, \,37361, \,42409,\\ \,151\,969, 2\,300\,927, \,9\,092\,137, \,17\,830\,441, \,118\,490\,767$$

(Compare A038873)

Of the eleven such odd primes $<101$, nine appear as factors of $k$ in the sample above. And of the remaining two: $$k_m=6\,925\,661\,896\,845\,871=97\cdot3407\cdot20\,956\,435\,649$$for $n=113$, and $$k_{m+1}=704\,428\,023\,733\,764\,953=7\cdot17\cdot23\cdot31\cdot41\cdot71\cdot21377\cdot133\,417$$for $n=117$.

It seems, then, that besides $2$ and its even powers, all and only all odd primes $p\equiv {1, 7}\pmod 8$ can be factors of$$k=|2^n-m^2|$$for $m^2$ generally, and therefore also for $m^2$ closest to $2^n$.

Other observations/conjectures

It is natural to wonder whether, like $7$, some two-digit prime, e.g. $17, 23, 89$, or perhaps some two-digit composite number, e.g. $2^2\cdot7=28$, can make a second appearance as the lesser value of $k$ for some $n$. Clearly every $2^n$ is quadruple the preceding one. And whenever $m$ or $m+1$ is double its predecessor then $m^2$ or $(m+1)^2$ will also be quadruple its predecessor, and so too consequently will be the value of $k$. E.g. $k_m$ quadruples five times for $n=15\rightarrow25$. Again, $k_{(m+1)}$, quadruples four times for $n=31\rightarrow39$.

If every $m$ and $m+1$ were double the preceding one, $k$ would forever quadruple with each increasing $n$: no value of $k$ could reoccur even once, as $1$ and $7$ do. But of course since $m$, $m+1$ are of opposite parity for any given $n$, they can never both be double their predecessor: rather, about as often as it doubles, $m$ increases by double-plus-one, and $m+1$ by double-minus-one (see table above). And then, instead of quadrupling, $k$ can become even less than the previous $k$, as happens either to $k_m$ or $k_{m+1}$ for $$n=3,\,11,\,15,\,21,\,27,\,31,\,31,\,39,\,43,\,47,\,51,\,55,\,59$$in the table above.

On the other hand, considering only lesser k: for odd $n\le999$ (Cf. A236564, Links), $\mathbf{k}$ for $2^n$ never exceeds $\mathbf{k}$ for $2^{n+2}$ by more than two digits. And even this occurs only six times, for$$n=59,\,527, \,669,\,695,\,905,\,973$$Following this conservative rule, then, we would not expect a new or reocurring two-digit $\mathbf{k}$ after the last four-digit $\mathbf{k}=5503$ for $n=27$, making composite $\mathbf{k}=2^2\cdot7=28$ for $n=17$ the last two-digit $\mathbf{k}$. Similarly, it seems three-digit $\mathbf{k}$ must end after the last five-digit $\mathbf{k}=2^4\cdot41\cdot113=74128$ for $n=35$, making $2^6\cdot7=448$ for $n=21$ the last three-digit $\mathbf{k}$. There appears to be no prime three-digit $\mathbf{k}$. After the last six-digit $\mathbf{k}=7\cdot42409=296863$, for $n=39$, there should be no more four-digit $\mathbf{k}$: $5503$ is the last, and the only prime four-digit $\mathbf{k}$.