<s>[INST] Is my proof correct? $2^n=x^2+23$ has an infinite number of (integer) solutions. This is how I tried to prove it. Is it correct? Thanks!!
$2^n = x^2+23$
$x^2$ must be odd, therefore $x^2 = 4k+1$, where $k \in \mathbb{N}$.
$2^n=4k+24$
$k=2(2^{n-3}-3)$
Since $x^2=4k+1$,$ \ \ \ \ $ $k_1 = \frac{x_1^2-1}{4}$
and $k_2=\frac{(x_1+2)^2-1}{4}=\frac{x_1^2+4x_1+3}{4}$
If we substitute $x_1^2=4k_1 + 1$, we end up with:
$k_2=k_1 + \sqrt{4k_1+1} + 1$
Therefore, finding solutions of $k=2(2^{n-3} - 3)$ is comparable to
finding the solutions of $k+\sqrt{4k+1}+1=2(2^{n-3}-3)$
Let $p=2(2^{n-3}-3)$
Therefore, $(\sqrt{4k+1})^2=(p-k-1)^2$, so
$(p-k)^2 = 2(p+k)$
Since $p$ has an infinite number of solutions $(p-k)^2=2(p+k)$ also has an infinite number of solutions, which implies  the the original does also.
 [/INST] Here is another heuristic argument along probabilistic lines that there are finitely many solutions.
The distance between perfect squares near $n$ is approximately $2\sqrt{n}$. Thus, the probability of a given integer $n$ to be a perfect square is approximately $\frac1{2\sqrt{n}}$. Summing the probability that $2^n-23$ is a perfect square gives
$$
\begin{align}
\sum_{n=5}^\infty\frac1{2\sqrt{2^n-23}}
&\le\frac16+\sum_{n=6}^\infty\frac1{2\sqrt{2^{n-1}}}\\
&=\frac16+\frac{\sqrt2+1}8
\end{align}
$$
According to the Borel-Cantelli Lemma, this indicates that the probability that there are finitely mny solutions is $1$.
Of course, this really proves nothing, because the same argument suggests that there are finitely many perfect squares of the form $2^n$, when in fact $2^n$ is a perfect square whenever $n$ is even. However, in the absence of proof to the contrary, this provides a decent guess.
</s>