**Computing method searching 3D perfect Euler
bricks (or Euler cuboids)**

This system for 3D perfect Euler brick (a, b, c):

- a² + b² = p² [system 2]
- a² + c² = q²
- b² + c² = r²
- a² + b² + c² = s²

can be rewritten:

- p² + c² = s² [system 2']
- q² + b² = s²
- r² + a² = s²
- a² + b² + c² = s²

meaning that s² has at least three different ways to be a sum of two squares. For any primitive brick, all prime factors of s are of the form 4k+1.

Here is a method searching 3D perfect Euler bricks, based on the factorization of s.

Construct a list of primes of the form 4k+1,
and their unique ways to be sums of two squares a²+b² (a odd, and b even):

5 = 1²+2²,
13 = 3²+2², 17 = 1²+4², 29 = 5²+2², 37 = 1²+6², 41 = 5²+4², ...

Do a loop building s with various factors of primes of the form 4k+1, and on each s:

- Construct all the possible primitive ways for s² to be a sum of two squares, using the list of the prime factors of s, and using the fact that a product (a² + b²)(c² + d²) has only two different primitive ways to be a sum of two squares:
- (ad + bc)² + (ac – bd)²
- (ad – bc)² + (ac + bd)²
- (a² - b²)² + (2ab)²

and that (a² + b²)² has only one primitive way to be a sum of two squares:

- Among this list of primitive ways for s², if three of
them (say a
_{1}²+b_{1}² = s², a_{2}²+b_{2}² = s², and a_{3}²+b_{3}² = s², with a_{i}odd, and b_{i}even) can produce a_{1}²+b_{2}² +b_{3}² also summing to s², then we have a 3D perfect Euler brick!