Pythagorean Triples
Pythagorean Triples
Every primitive Pythagorean triple has the form where and are relatively prime integers of opposite parity with . We list all such triples whose parameters are bounded above by max.
(-,2mn,+)
2
m
2
n
2
m
2
n
m
n
m>n≥1
(m,n)
In[]:=
max=10;For [m=2, m<=max, m++, For [n=1, n<m, n++, If [GCD[m,n]==1 && Mod[m+n,2]==1, Print["The pair (m,n)=(",m,",",n, ") gives the primitive Pythagorean triple (",m^2-n^2,",",2*m*n,",",m^2+n^2,")."]]]]