# When is $2^{2n+2}+2^{m+2}+1$ a perfect square?

Let $m,n$ be natural numbers satisfying $m\leq 2n$. Is it true that $$2^{2n+2}+2^{m+2}+1$$ is a perfect square if and only if $m=n$?

What I have tried: Under the assumption $m<n$, I've tried to 'squeeze' the above number between two consecutive squares, implying it cannot be a perfect square. This works fine because (writing $P(m,n)=2^{2n+2}+2^{m+2}+1$), we have $(2\cdot2^n)^2<P(m,n)<(2\cdot2^n+1)^2$. But this method doesn't work when $\frac{m}{2}\leq n<m$, and I wonder if there is any pair $(m,n)$ with $m\ne n$ making $P(m,n)$ a perfect square.

• Le $m 2; n = 3$ then $2^8 + 2^5 + 1 = 17^2$. Mar 11, 2018 at 3:12
• @fleablood that actually uses $m=3$ Mar 11, 2018 at 3:14
• You're right. ........ Mar 11, 2018 at 3:15

Suppose $m>n$ and $k$ is an integer such that $$(2^{n+1}+k)^2= 2^{2n+2}+2^{m+2}+1.$$ This means $$2^{n+2}k+k^2=2^{m+2}+1$$ so $$(k-1)(k+1)=k^2-1=2^{n+2}(2^{m-n}-k).$$ Note that clearly $k$ must be odd and $\gcd(k-1,k+1)=2$, so either $k-1$ or $k+1$ is divisible by $2^{n+1}$. Since $k>1$ (if $k=1$ we would have $m=n$), this means that $k\geq 2^{n+1}-1$. Plugging this into the second equation above gives $$2^{m+2}+1\geq 2^{n+2}(2^{n+1}-1)+(2^{n+1}-1)^2=2^{2n+3}+2^{2n+2}-2^{n+3}+1.$$ As long as $n\geq 1$ (the case $n=0$ is trivial) we have $2n+2\geq n+3$ so we can conclude $$2^{m+2}\geq 2^{2n+3}$$ and thus $m\geq 2n+1$.

Thus, if $n<m\leq 2n$, then no such integer $k$ can exist and $2^{2n+2}+2^{m+2}+1$ is not a perfect square.

• Actually, probably you can get a simpler argument by just using $k$ instead of $2^{n+1}+k$ for the square root. I don't feel like rewriting my answer at the moment, so if someone else wants to write that up as their own answer, feel free to. Mar 11, 2018 at 3:28

Let $$2^{2n+2}+2^{m+2}+1=(2k+1)^2\text{where}\; k\ge 2\\ \implies 2^{2n}+2^m=k^2+k$$ For $m=2n$, $2^{m+1}=k(k+1)$. All factors of $2^{m+1}$ are even but one of $k$ and $k+1$ is odd. Hence $m\neq 2n$

For $m\lt 2n$, $2^m(2^{2n-m}+1)=k(k+1)$ The factors on both sides are co-prime. So $k=2^m$ and $k+1=2^{2n-m}+1\implies m=n$

Or $k=2^{2n-m}+1$ and $k+1=2^m$ which means $k$ is one more and one less than powers of $2$ which is only possible if $k=3\implies n=\frac32$ which is impossible.

Hence, $2^{2n+2}+2^{m+2}+1$ is perfect square if and only if $m=n$