Pythagorean triples
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?