Problem: For a given positive integer $k$, we call an integer $n$ a $k$-number if both of the following conditions are satisfied: (i) The integer $n$ is the product of two positive integers which differ by $k$. (ii) The integer $n$ is $k$ less than a square number. Find all $k$ such that there are infinitely many 𝑘-numbers. (BMO2 2022)
Solution: Note that $n$ is a $k$-number if and only if the equation $n = m^2 − k = r(r + k)$ has solutions in integers $m, r$ with $k \geq 0$. The right-hand equality can be rewritten as $k^2 − 4k = (2r + k)^2 − (2m)^2$ , so $k$-numbers correspond to ways of writing $k^2 − 4k$ as a difference of two squares, $N^2 − M^2$ with $N > r$ and $M$ even (which forces $N$ to have the same parity as $k$). Any non-zero integer can only be written as a difference of two squares in finitely many ways (because each gives a factorisation, and a number has only finitely many factors). If $k \neq 4$ then $k^2 − 4k \neq 0$, and as a result, if $k \neq 4$ then there are only finitely many $k$-numbers. Conversely, if $k = 4$ then setting $m = r + 2$ for $r \geq 0$ shows that there are infinitely many $4$-numbers.
"so $k$-numbers correspond to ways of writing $k^2 − 4k$ as a difference of two squares" - how does this work? Also, is there any motivation for doing this, or is the difference of squares just a very common method to prove there does not exist an infinite amount of something?