# Solving $a^2-24 a=k^2$ across the integers

$$a^2-24 a=k^2$$

I was trying to solve another problem that essentially boiled down to finding all possible integer values of a such that $a^2-24 a$ was a perfect square, and I thus came up with the above equation.

However, usually to solve squared diophantine equations I would try to bring it to a form with a constant term on one side and a product of terms on the other, at which point the constant term could be factored and its factors matched back to the product of the terms. However, in this equation I don't see any way to do that.

Rewrite as $(a-12)^2-144=k^2$, and then as $b^2-k^2=144$, where $b=a-12$.

To find all the solutions of $b^2-k^2=144$, let $u$ and $v$ be any two integers whose product is $36$, and set $b-k=2u$, $b+k=2v$ and solve. We get $b=u+v$, $k=v-u$.

Note that $36$ has $9$ positive divisors, so there are $18$ possible values for the pair $(u,v)$.

Let $\displaystyle a^2-24a=(a-b)^2$ where $b$ is some integer

$\displaystyle\iff b^2=2a(b-12)\implies2|b^2\implies2|b$ as $2$ is prime

$b=2c$(say) where $c$ is some integer

$\displaystyle\implies c^2=a(c-6)\iff a=\frac{c^2}{c-6}=\frac{c^2-36+36}{c-6}=c+6+\frac{36}{c-6}$

So, the necessary & sufficient condition is $(c-6)$ must divide $36$