Pythagorean triples

Revision as of 15:13, 28 June 2011 by rosettacode>Ledrug (Created page with "{{draft task}} A Pythagorean triple is defined as three positive integers <math>(a, b, c)</math> where <math>a\leq b\leq c</math>, and <math>a^2+b^2=c^2...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A Pythagorean triple is defined as three positive integers where , and They are called primitive triples if are coprime. Each triple form the length of the sides of a right triangle, whose perimeter is .

Pythagorean triples is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Task

How many Pythagorean triples are there with a perimeter no larger than 100? Of these, how many are primitive?

Extra: Can your program handle a max perimeter of 1,000,000? What about 10,000,000? 100,000,000?