Diophantine equation: $x^2-y^2=z$ for a fixed integer $ z$

158 Views Asked by At

Is there any relatively efficient way to calculate integer solutions $x$ and $y$ to the equation $x^2 - y^2 = z$ for a fixed integer $z$?

May or may not be useful: $z$ is an odd composite number

Thanks

2

There are 2 best solutions below

1
On

Write $z$ as $z=ab$. Hence, one solution for $x^2-y^2 = ab$ is $(x+y) = a \text{ and } x-y =b$.

I am sure you can take it from here.

0
On

HINT:

If $z$ is odd, $z\pm 1$ i s even $\implies \frac{z\pm1}2$ is integer

$$z\cdot1=\left(\frac{z+1}2\right)^2-\left(\frac{z-1}2\right)^2$$

If $z$ composite odd $=m\cdot n$(say), $m\pm n$ is even

$$m\cdot n=\left(\frac{m+n}2\right)^2-\left(\frac{m-n}2\right)^2$$