How to make a perfect square integer from two other integers?

59 Views Asked by At

If I have a pair of integers, $X$ and $Y$, I would like to find an integer $\lambda$ such that $$ X - \lambda Y = t^2 $$ where $t$ is any other integer. All these integers can be either positive or negative.

Just wondering whether there is an simple formula or algorithm for finding either one or all the solutions.

1

There are 1 best solutions below

3
On

All perfect squares are congruent to either $0$ or $1$ modulo $4$.

So $3-4\lambda$ is not a perfect square for any integer $\lambda$.