Source

project-euler / project-euler / 75 / 75-analysis.txt

A^2 + B^2 = C^2

This already implies that C+A > B , C+B > A and A+B > C. The latter is because
(A+B)^2 = A^2 + 2AB + B^2 > A^2+B^2 = C^2.

Now, here is the modulo 2 of the results:

 A | B | === | C | A+B+C
-----------------------
 0   0         0 |  0
 1   0         1 |  0
 1   1         0 |  0
-------------------------

Ergo, the sum is always even.

(2a+1)*(2a+1) = 4a^2+4a+1
(2b+1)*(2b+1) = 4b^2+4b+1

[4a^2+4a+1+4b^2+4b+1] mod 4 = 2, and a square number cannot have a modulo
of 2 when divided by 4. As a result, either one of 'a' or 'b' or both should
be even.

Now for mod 4:

 A | B | A^2 | B^2 | === | C^2 | C | A+B+C
------------------------------------------
 0   0     0     0           0 | 0 | 0
 1/3 0     1     0           1 |
 1   1         0 |  0
-------------------------

------------------------------------------

If A^2 + B^2 = C^2 then so will (mA)^2 + (mB)^2 = (mC)^2

------------------------------------------

A^2 + B^2 = C^2 ; A+B+C <= 1,500,000