$A^2 + B^2 + C^2 = D^2 + E^2 + F^2$ and $A^2 + F^2 = B^2 + E^2 = C^2 + D^2$, distinct positive integers I am looking for parametric formula to this system of equations:
$A^2 + B^2 + C^2 = D^2 + E^2 + F^2$
$A^2 + F^2 = B^2 + E^2 = C^2 + D^2$
for distinct positive integers $A,B,C,D,E,F$. According to my computations, solutions for this system are rare. It looks like this is the smallest one:
$421^2 + 541^2 + 49^2 = 559^2 + 149^2 + 371^2$
$421^2 + 371^2 = 541^2 + 149^2 = 49^2 + 559^2$
I would like to know if there is any known algebraic formula (or method) to find these solutions faster (better than bruteforce).
 A: Since the equations are all homogeneous of degree $2$, we can multiply a solution by a constant to produce another solution.
We may assume we have a primitive solution, i.e. $\gcd(A,B,C,D,E,F)=1$.
Let's start with $A^2 + F^2 = B^2 + E^2 = C^2 + D^2$.  Call this common value $x$.   Note that if $x \equiv 0 \mod 4$, all of $A,B,C,D,E,F$ are even, so in a primitive solution $x \equiv 1$ or $2 \mod 4$.  Moreover, in a primitive solution $x$ can't be divisible by any prime $\equiv 3 \mod 4$.  You need $x$ to be divisible by at least $3$ (not necessarily distinct) primes $\equiv 1 \mod 4$ to allow $x$ to be written as the sum of two squares in $3$ different ways with all distinct squares.
So one approach would be to look at products of three (or more) primes $\equiv 1 \mod 4$ and (optionally) $2$.  For each such $x$,
consider all ways to write $x$ as the sum of two squares. Take choices of three of those which involve $6$ distinct squares, and
see if you can get $A^2 + B^2 + C^2 = D^2 + E^2 + F^2$.
Taking three such primes $< 300$ and optionally $2$, I get your solution as well as one other:
$$(A,B,C,D,E,F) = (931, 1541, 1691, 1099, 1301, 1789)$$
Using four primes $< 200$ and $2$, I get another solution:
$$(A,B,C,D,E,F) = (137, 1123, 1523, 283, 1067, 1543)$$
EDIT: And here's another one:
$$(A,B,C,D,E,F) = (15953, 23393, 24553, 18263, 19727, 26113)$$
