Pythagorean triples

Searching for the pythagorean triples with a given side.
(x,y,z) is a pythagorean triple with given side x and hypothenuse z if and only if there exist m,r,s with :
either x = 2mrs, y = m(r² - s²), z = m(r²+s²)
or x = m(r² - s²), y = 2mrs , z = m(r² + s²)   (proof)
This script searches for all divisors of x, giving m, r, s or r+s, r-s.
Some triples are obtained more than once in that way, and duplicates are filtered out.
x =

 

 

Home Arithmetic Geometric Misc Topics Scripts Games Exercices Mail Version Française Previous topic Next topic