# PTRIPLESEARCH -- search for Pythagorean triples # # ptripsearch(2,100) prints the primitive Pythagorean # triples (x,y,z) which it finds satisfying the # inequalties 2 <= x <= y <= z <= b. It returns # the number of such triples which it finds. ptriplesearch := proc(a,b) local i,j,k,count; count := 0; for i from a to b do for j from i to b do for k from j to b do if i^2 + j^2 = k^2 and gcd(i,j) = 1 then print( i, j, k ); count := count + 1; fi; od; od; od; RETURN( count ); end: # jac, 6/10/2001