TITLE: Are there any two squares with a distance of a power of 2 between them?
QUESTION [6 upvotes]: I was working with Pythagorean triples and found a formula to generate Pythagorean triples. I am pretty sure every Pythagorean triple falls under my formula. This formula is: If $a$, $x$, and $n$ are all integers greater than zero, and $x = (2a + 1)n$, then the set $\{x,\frac{x^2 - n^2}{2n}, \frac{x^2 + n^2}{2n}\}$ is a Pythagorean triple. After playing around with these numbers for awhile I figured out that if I am correct, no two squares are a distance of a power of $2$ apart. Could someone confirm this to be true?

REPLY [3 votes]: More generally, if $c=2^{n-2}+1$ and $a=2^{n-2}-1$ then $c^2-a^2=2^{n}$.
When $n$ is even, $a=u^2-1, b=2u, c=u^2+1$ is a Pythagorean triple, for $u=2^{(n-2)/2}$, and $c^2-a^2=b^2=2^n$.
It is true for the legs of a Pythagorean triple, other than $2^0=1$, of course, under the condition that the legs are relatively prime.
Alternatively, it is definitely true that the difference cannot be an odd power of $2$.