Find all positive integers $n$ such that $2^8+2^{12}+2^n$ is a perfect square

Find all positive integers $n$ such that $2^8+2^{12}+2^n$ is a perfect square.

For $n=2$ and $n=11$, $2^8+2^{12}+2^n$ is a perfect square.

How to find a closed form?

• Another one is $n=13$. – Crostul Nov 30 '15 at 16:52
• For $n\ge 8$, we reduce the problem to deciding when $1+2^4+2^{n-8}=17+2^{n-8}$ is square. – vadim123 Nov 30 '15 at 16:59
• The odd is the main part of this problem. Modular bashing for larger values maybe? – Gyumin Roh Nov 30 '15 at 17:06
• What is the source of this problem? – user236182 Nov 30 '15 at 17:07
• Solve $2x^2+17=y^2$, and take these $x_k=2^m \mod p$ – Empy2 Nov 30 '15 at 17:09

If $n\in\{1,2,\ldots,7\}$, then $n=2$ is the only solution. Let $n\ge 8$. Then $2^8\left(1+2^4+2^{n-8}\right)$ is a square iff $17+2^{n-8}$ is a square. Let $n-8=m$. You're solving $17+2^m=k^2$ in non-negative integers.

All the solutions are $m=3,5,6,9$. Now, the solutions for $m$ are relatively large, and assuming $m\ge 10$ and using mod $2^{k}$, $k\ge 10$ won't help, because $17$ will always be a quadratic residue.

This is very similar to Ramanujan–Nagell equation, namely $2^n-7=x^2$, which has the solutions $n=3,4,5,7,15$.

This equation has already been asked about on M.SE (see here and here), and the only solution someone could come up with uses Mordell's equations, so I'll use them here. We have three cases:

• $m=3t,\, t\ge 0$. Then $17+\left(2^t\right)^3=k^2$. But $17+a^3=b^2$ has $16$ solutions (see http://oeis.org/A081119 and http://oeis.org/A081119/b081119.txt), which can be found with a program or this table:

$$(a,b)=(-2,\pm 3), (-1,\pm 4), (2,\pm 5), (4,\pm 9),$$

$$(8,\pm 23), (43,\pm 282), (52,\pm 375), (5234,\pm 378661)$$ This gives $m=3,6,9$.

• $m=3t+1,\, t\ge 0$. Then $2^m\equiv 2\pmod{7}$, so $k^2\equiv 5\pmod{7}$, impossible, because $5$ is not a quadratic residue mod $7$.

• $m=3t+2,\, t\ge 0$. Then $272+\left(2^{t+2}\right)^3=(4k)^2$. But $272+a^3=b^2$ has $2$ solutions (http://oeis.org/A081119/b081119.txt), which are $(a,b)=(8,\pm 28)$. This gives $m=5$.