Finding integer solutions to the system $xy=6(x+y+z)$, $x^2+y^2=z^2$ How do you go about solving a system of equations like below for integer solutions?
$$xy=6(x+y+z)$$
$$x^2+y^2=z^2$$
Would you first try and list out a number of Pythagorean triples, then try and see which ones when multiplied are divisible by 6 (by 2 and 3)? Since the other side is just the sum of the 3 of them left.
I mean is there an elegant way to find these triplets, apart from a brute-force or any exhaustion method? Or even using Graphs perhaps? And why is there not infinite solutions to this? (there are actually 6 triplets).
P.S. As a bonus, replace the first equation above with:
$$x^2 + (z-510)x + 1020p = 0$$
while in the 2nd equation:
$$y=1020p/x$$
where $p$ is Prime.
Mathematica gives me only 2 solutions for $p$ for this. But how??
 A: Let $t = x+y+z \implies z^2 = x^2+y^2 = (x+y)^2 - 2xy = (x+y+z - z)^2 - 2\cdot 6(x+y+z)= t^2-2tz+z^2-12t\implies t^2-2tz-12t=0\implies t(t-2z-12)=0\implies t = 0$ or $t = 2z+12$. Thus $x+y=-z$ or $x+y+z=2z+12$ or $x+y=z+12$. Thus first case yields $xy = 0 \implies x = 0 $ or $y = 0$ or $x = y = 0=z$. Thus $x = 0, y = -z$ is a solution, and $x = -z, y = 0$ is another. For if $x+y = z+12 \implies x^2+y^2=(x+y-12)^2= x^2+y^2+144+2xy-24x-24y\implies 24x+24y=144+2xy\implies 24x-2xy=144-24y\implies 12x-xy=72-12y\implies (12-y)x=72-12y\implies x = \dfrac{72-12y}{12-y}= 12- \dfrac{72}{12-y}\implies (12-y)\mid 72\implies 12-y = \pm \{1, 2,3,4,6,8,9,12,18,24,36,72\}$. You can now check case by case to pick the one that is a solution.
A: This is the first way that came to my mind.  Maybe there is a shorter way.
$$(x+y)^2=z^2+12z+12(x+y)$$
$$t^2-12t-(z^2+12z)=0, ~t=x+y$$
$$\Delta_{\text{half}}=36+z^2+12z=(z+6)^2$$
$$t_{1,2}=6±|z+6|=6±z+6=12±z$$
$$x+y=12±z$$
$$xy=6(x+y+z)=6(z+12±z)$$
If $x+y=12-z$, then $xy=72$.
Check all integers $x,y$ such that $xy=72$.

If $x+y=12+z$, then
$$xy=6(x+y+z)=6(12+2z)=12(z+6)$$
Finally, we have
$$(x-y)^2=(x+y)^2-4xy=(12+z)^2-48(z+6)=z^2-24z-144=(z-12)^2-288$$
$$(z-12)^2-(x-y)^2=288$$
$$(z-12-x+y)(z-12+x-y)=288=2^5×3^2$$
Then, check all possible factors of $288$:
If $m=±1,±2 \cdots ±288$, then
$$\begin{cases} z-x+y-12=\frac{288}{m} \\z+x-y=m \\x+y=12+z \end{cases}$$
