Pythagorean Triples Calculator

Generate Pythagorean triples up to any limit, verify three numbers, or apply Euclid's formula to build a triple from two integers.

๐Ÿ“ Pythagorean Triples Calculator
Maximum Hypotenuse (limit)100
units
5500
Integer a
Integer b
Integer c
m (larger integer)
n (smaller integer, n < m)
Total Triples Found
Primitive Triples
Smallest Triple
Largest Triple

๐Ÿ“ What is a Pythagorean Triple?

A Pythagorean triple is a set of three positive integers (a, b, c) that satisfy the Pythagorean theorem: a² + b² = c². These three integers represent the side lengths of a right triangle, where c is always the hypotenuse (the longest side, opposite the right angle). The most famous triple is 3-4-5 because 9 + 16 = 25. Other well-known examples include 5-12-13, 8-15-17, 7-24-25, and 20-21-29.

Pythagorean triples appear across a remarkable range of practical contexts. Builders and surveyors use the 3-4-5 rule to verify perfect right angles at corners. Architects use them to design staircases and roof pitches with exact integer dimensions. Computer graphics programmers use Pythagorean triples to represent diagonal distances without floating-point rounding. Number theorists study them because they are the integer solutions to a Diophantine equation with a beautifully complete structure.

There are two kinds of Pythagorean triples. A primitive triple has gcd(a, b, c) = 1, meaning the three numbers share no common factor greater than 1. Examples include 3-4-5 and 5-12-13. A non-primitive triple is any integer multiple of a primitive triple, such as 6-8-10 (which is 2 times 3-4-5) or 9-12-15 (which is 3 times 3-4-5). Every Pythagorean triple is either primitive or can be reduced to a primitive triple by dividing by the GCF.

Euclid proved around 300 BCE that every primitive Pythagorean triple can be generated by two coprime integers of opposite parity. Specifically, for m greater than n greater than 0, with gcd(m, n) = 1 and exactly one of m or n even, the formulas a = m² − n², b = 2mn, and c = m² + n² produce every primitive triple exactly once. For example, m = 2, n = 1 gives 3-4-5; m = 3, n = 2 gives 5-12-13; m = 4, n = 1 gives 15-8-17.

๐Ÿ“ Formula

a² + b² = c²
a, b = the two legs of the right triangle (shorter sides)
c = the hypotenuse (longest side, opposite the right angle)
a = m² − n²    b = 2mn    c = m² + n²
m = larger positive integer (m > n > 0)
n = smaller positive integer
Primitive condition: gcd(m, n) = 1 and m − n is odd (opposite parity)
Example: m = 3, n = 2 → a = 9 − 4 = 5, b = 12, c = 13. Check: 25 + 144 = 169 = 13²

๐Ÿ“– How to Use This Calculator

Steps

1
Choose a mode - Select Generate Triples to list all triples up to a limit, Check a Triple to verify three specific integers, or Euclid's Formula to build a triple from two integers m and n.
2
Enter your values - In Generate mode, drag the slider or type a hypotenuse limit (up to 5000). In Check mode, enter three positive integers in any order. In Euclid mode, enter m and n where m is greater than n.
3
Click Calculate - The results appear immediately. Generate mode shows a sortable table of all triples, labeled primitive or non-primitive. Check mode shows a pass or fail verdict with the full arithmetic equation.
4
Read the output - In Euclid mode, the calculator also labels whether your (m, n) pair produces a primitive triple based on the gcd and parity conditions.

๐Ÿ’ก Example Calculations

Example 1 - Generate all triples up to hypotenuse 50

Find all Pythagorean triples with hypotenuse at most 50

1
Set mode to Generate Triples and enter limit = 50.
2
The algorithm finds all primitive triples up to 50: 3-4-5, 5-12-13, 8-15-17, 7-24-25, 20-21-29, 9-40-41, 12-35-37.
3
Non-primitive triples also listed: 6-8-10, 5-12-13 (wait - that's primitive), 9-12-15, 12-16-20, 15-20-25, 8-15-17, 20-48-52 (beyond 50), 10-24-26, etc.
Result: 16 total triples with 7 primitive triples, hypotenuse range 5 to 50
Try this example →

Example 2 - Check whether 9-40-41 is a Pythagorean triple

Verify: Does 9² + 40² = 41²?

1
Set mode to Check a Triple and enter a = 9, b = 40, c = 41.
2
Compute: 9² = 81, 40² = 1600, sum = 1681. Also: 41² = 1681. Sum matches.
3
Check gcd(9, 40, 41): gcd(9, 40) = 1, gcd(1, 41) = 1. So it is primitive.
Result: Yes, 9-40-41 is a primitive Pythagorean triple
Try this example →

Example 3 - Use Euclid's formula with m = 5, n = 2

Generate the triple from m = 5, n = 2

1
Set mode to Euclid's Formula and enter m = 5, n = 2.
2
Compute: a = m² − n² = 25 − 4 = 21. b = 2mn = 2 × 5 × 2 = 20. c = m² + n² = 25 + 4 = 29.
3
Verify: 20² + 21² = 400 + 441 = 841 = 29². Check parity: 5 − 2 = 3 (odd), gcd(5, 2) = 1. Primitive.
Result: Triple is 20-21-29 (primitive)
Try this example →

โ“ Frequently Asked Questions

What is a Pythagorean triple?+
A Pythagorean triple is a set of three positive integers a, b, c satisfying a squared plus b squared equals c squared. These represent the side lengths of a right triangle. The most famous example is 3-4-5 (9 + 16 = 25). There are infinitely many Pythagorean triples, and this calculator generates them all up to any hypotenuse limit you choose.
What is a primitive Pythagorean triple?+
A primitive Pythagorean triple is one where the three numbers share no common factor other than 1 (their GCF is 1). Examples: 3-4-5, 5-12-13, 8-15-17, 7-24-25. Non-primitive triples are multiples of primitive ones: 6-8-10 is 2 times 3-4-5, and 15-20-25 is 5 times 3-4-5. All Pythagorean triples are either primitive or multiples of primitive triples.
How does Euclid's formula generate Pythagorean triples?+
Euclid's formula produces a Pythagorean triple from any two positive integers m and n (m greater than n): a = m squared minus n squared, b = 2mn, c = m squared plus n squared. For a primitive triple, m and n must be coprime (gcd = 1) and have opposite parity (one odd, one even). Example: m = 3, n = 2 gives a = 5, b = 12, c = 13. Verify: 25 + 144 = 169 = 13 squared.
Is 6-8-10 a Pythagorean triple?+
Yes. 6 squared + 8 squared = 36 + 64 = 100 = 10 squared, so 6-8-10 satisfies the Pythagorean theorem. However, it is not a primitive triple because gcd(6, 8, 10) = 2. It is simply the 3-4-5 triple scaled by 2. Other non-primitive multiples of 3-4-5 include 9-12-15, 12-16-20, 15-20-25, and 30-40-50.
How do you check if three numbers form a Pythagorean triple?+
Sort the numbers so the largest is c. Compute a squared plus b squared. If it equals c squared, the three numbers are a Pythagorean triple. Example: check 20-21-29. Sort: 20, 21, 29. 20 squared + 21 squared = 400 + 441 = 841. 29 squared = 841. Match: yes, 20-21-29 is a Pythagorean triple. Use the Check mode in this calculator for instant verification.
What are the first 10 primitive Pythagorean triples?+
The first 10 primitive Pythagorean triples ordered by hypotenuse are: 3-4-5, 5-12-13, 8-15-17, 7-24-25, 20-21-29, 9-40-41, 12-35-37, 11-60-61, 13-84-85, and 28-45-53. Every one of these has gcd(a, b, c) = 1. Use the Generate mode with limit 90 to see all of them in a table.
How is the 3-4-5 rule used in construction?+
The 3-4-5 rule is a quick field method for checking right angles. Measure 3 units along one edge, 4 units along the perpendicular edge, and verify the diagonal is exactly 5 units. If it is, the corner is 90 degrees. For larger layouts, scale up: 6-8-10, 9-12-15, or 30-40-50 all work equally well. This technique predates modern surveying instruments and is still used by carpenters and landscapers daily.
Are there Pythagorean triples with consecutive integers?+
Yes. Triples with consecutive legs include 3-4-5, 20-21-29, 119-120-169, and 696-697-985. Triples with the two larger numbers consecutive (like 3-4-5 where 4 and 5 are consecutive) follow the pattern (n, (n squared minus 1) divided by 2, (n squared plus 1) divided by 2) for odd n greater than 1: 3-4-5, 5-12-13, 7-24-25, 9-40-41, 11-60-61.
How many Pythagorean triples have hypotenuse at most 100?+
There are 52 Pythagorean triples with hypotenuse at most 100, of which 16 are primitive. The primitive ones include 3-4-5, 5-12-13, 8-15-17, 7-24-25, 20-21-29, 9-40-41, 12-35-37, 11-60-61, 13-84-85, 36-77-85, 20-99-101 (over 100), 28-45-53, 33-56-65, 36-77-85, 48-55-73, and 65-72-97. Enter limit = 100 in the Generate mode to see all 52.
Can Pythagorean triples include even hypotenuses?+
In primitive triples, the hypotenuse c is always odd. This is because in Euclid's formula c = m squared plus n squared, and for opposite-parity m and n, one is even and one is odd, so their squares sum to an odd number. However, non-primitive triples can have even hypotenuses. For example, 6-8-10 has hypotenuse 10, which is even (it is 2 times the 3-4-5 primitive triple).
What happens in Euclid's formula when m and n have the same parity?+
When both m and n are even or both are odd, the formula still generates a valid Pythagorean triple, but it will not be primitive. For example, m = 2, n = 2 fails because n must be less than m. Try m = 3, n = 1 (both odd): a = 8, b = 6, c = 10. That is 2 times 3-4-5, a non-primitive triple. The calculator flags this case with the primitive label set to No.