MathsReadCompetitive mathematics
Pattern recognition · integer answerhard30 min

Counting primitive Pythagorean triples

Primitive Pythagorean Triples

How many primitive Pythagorean triples of positive integers satisfy a<b<c, a²+b²=c², gcd(a,b,c)=1 and c≤500? Swapping the two legs does not create a new triple. For example, (3,4,5) and (5,12,13) qualify, but (6,8,10) does not. Submit one integer.

Learning goal: Use structural parameterisation to count primitive integer triples exactly.

Look for the underlying structure rather than guessing the next number. Submit only the final integer; you can open hints below as needed.

Check your answer without signing in. Sign in to save your progress.

Accepted format: a whole number such as 42 or 123456789. No commas, formulas, or source code.

Hints

Hint 1

Recall Euclid’s parameterisation of primitive Pythagorean triples.

Hint 2

Choose integers m>n>0 with gcd(m,n)=1 and opposite parity; c=m²+n².

Hint 3

Count eligible pairs with m²+n²≤500. It is enough to examine m≤22.

Common mistake to avoid

Counting scaled copies or both permutations of the legs.

How to approach this problem

Generate primitive triples with coprime integers m>n of opposite parity, using the standard formulas for legs and hypotenuse. Apply the hypotenuse bound and count each pair once.

Worked example with different values

m=4,n=1 yields legs 15 and 8 and hypotenuse 17; they form a primitive triple.

Apply the same reasoning to the challenge. This example is a separate practice problem.

Learn the technique: Sequence patterns: differences, recurrences and interleaving

Report a question or explanation issue

Sequence patterns · Repeating remainders

Back to problems →