How to use the pythagorean triples generator
- Choose Triples up to a size and enter the largest hypotenuse (from 5 to 5,000), or choose Triples with a leg and enter a known leg (from 3 to 1,000,000).
- For a size limit, tick the box to include multiples of the basic triples, such as 6, 8, 10 from 3, 4, 5.
- Read the count of triples and how many are primitive, which means the three sides share no common factor.
- The table shows each triple with the Euclid numbers m and n that produce it. Only the first 300 rows are shown, and the CSV has them all.
Formula
for whole numbers m > n with no common factor and not both odd:
a = m^2 - n^2, b = 2 x m x n, c = m^2 + n^2
every primitive triple comes from exactly one such pair
for a known leg: (c - b)(c + b) = leg^2, so factor pairs of leg^2 give the triangles
A triple is primitive when the greatest common divisor of a, b and c is 1. Every other triple is a primitive triple with all three sides multiplied by the same whole number.
Triples up to 50 and 100, and a leg of 12
Up to a hypotenuse of 50 there are 20 triples, of which 7 are primitive: 3-4-5, 5-12-13, 8-15-17, 7-24-25, 20-21-29, 12-35-37 and 9-40-41. Up to 100 there are 52 triples with multiples included, and 16 primitive ones. Up to 200 the counts are 127 and 32. A brute force check of all pairs of legs gave the same counts.
The right triangles with a leg of 12 are 5-12-13, 9-12-15, 12-16-20 and 12-35-37. Only 5-12-13 and 12-35-37 are primitive. A leg of 7 appears only in 7-24-25, and a leg of 3 only in 3-4-5. For a leg of 12, the factor pairs of 144 with the same parity give the four triangles.
Why Euclid's formula finds them all
Any right triangle with whole-number sides can be scaled down to one with no common factor, and Euclid's formula describes every such triangle with the two numbers m and n. The condition that m and n have no common factor and are not both odd makes sure the triple is primitive and that no triple is counted twice. For a hypotenuse up to a limit, the tool tries all m and n whose sum of squares fits.
Uses of the triples
Triples are handy in the workshop and in the classroom: a 3-4-5 triangle squares a corner, and a list lets a teacher write problems whose answers are whole numbers. To check one triangle or find a missing side, use the Pythagorean Theorem Calculator, and to solve any triangle use the Triangle Calculator.
More tools for playing with numbers
For more number patterns and conversions, try the Collatz Sequence Calculator, Egyptian Fraction Decomposer and Gray Code Converter.
Assumptions and limits
- The sides are positive whole numbers that satisfy a squared plus b squared equals c squared.
- The two legs are listed with the shorter one first, and each triangle is listed once.
- The hypotenuse limit is a whole number from 5 to 5,000, and the known leg from 3 to 1,000,000.
- Only the first 300 rows are shown on the page, but the counts and the CSV cover all of them.
- The limit and leg in the form are examples to replace with your own.
Frequently asked questions
What is a primitive triple?
It is a triple whose sides have no common factor except 1. 3-4-5 is primitive and 6-8-10 is not, since all three sides can be divided by 2.
Are there triples with every leg?
Every whole number from 3 up appears as a leg of at least one right triangle with whole-number sides. Some numbers, such as 3, 4, 5 and 7, have only one, while numbers with many factors have many.
Why can the number of rows be large?
With multiples included, a limit of 5,000 gives thousands of triples. The page shows the first 300 so that it stays readable and keeps the whole list in the CSV download.
Is there a triple where the two legs differ by 1?
Yes, such as 3-4-5 and 20-21-29. There are infinitely many of them, and they are found by a pattern in m and n.