The following algorithm may be used to find ALL Pythagorean Triples. And you find ONLY Pythagorean Triples. No need to check for correctness.
- Start with an even square number (4,16,36,64,100 etc.).
- Divide it by 2 you get (2,8,18,32,50 etc.)
In the continued description, I use 36 (6^^2) as example
- Factorize it in pairs included the factorization where 1 is one of the factors you get the following pairs:
(1,18), (2,9), (3,6)
Each pair will generate a Pythagorean triple as follows) (example using (1,18)):
a= 1+6 (the originating number squared)
giving the triple (7,24,25)
How to find this algorithm, see link
BTW, this is probably Fermat's own first step on how he proved his last theorem.