Find three distinct integers, X, Y and Z, such that X + Y, X + Z, Y + Z, X - Y, X - Z, and Y - Z are all squares of integers.
Apparently, there are many solutions.

Find the set [X, Y, Z] with the smallest X + Y + Z.

With the restriction that Z = -Y, the necessary squares are reduced to three in number; namely X + Y, X – Y and 2Y.

If we writeX + Y = a^{2},X – Y = b^{2}2Y = c^{2}

thenX = (a^{2} + b^{2})/2,Y = (a^{2} – b^{2})/2

and we require that a^{2} = b^{2} + c^{2}. We can use standard formulae to generate all coprime Pythagorean triples (a, b, c) using positive integers p, q, k, with p and q coprime and of opposite parity, and with p > q. Case 1:a = k(p^{2} + q^{2}),b = k(p^{2} – q^{2}),c = 2kpq

Since p and q have opposite parity, in case 2, X and Y will be integers iff k is even. So we could put k = 2K and for K = 1, 2, .. use the modified formula:

For small values of p, q, k, these generates [X,Y] pairs like: [82,18], [328,72], [626,50], [706,450], [738,162], [1312,288]...

If k = 1, only coprime triples (a, b, c) will be generated by the coprime pairs (p, q). So the parameter k is needed to produce all multiples of these triples.