Pythagorean Triple Generator

JJ Ben-Joseph headshot JJ Ben-Joseph

What This Pythagorean Triple Generator Does

This tool lists all Pythagorean triples whose hypotenuse c is less than or equal to a value you choose. You can optionally restrict the output to primitive triples only. It is designed for students, teachers, and developers who want a quick way to explore integer right triangles without writing code or doing repetitive calculations.

To use it, enter a positive integer in the Maximum hypotenuse value field. The calculator then finds every integer triple (a,b,c) with a² + b² = c² and c less than or equal to your limit. If you check the Primitive only option, the results will include only triples where a, b, and c have no common divisor greater than 1.

Typical uses include generating examples for classroom exercises, exploring number patterns, building lookup tables for programming projects, or checking work when solving geometry problems involving right triangles.

What Are Pythagorean Triples?

A Pythagorean triple is a set of three positive integers (a,b,c) that satisfy the Pythagorean theorem

a2 + b2 = c2

If you interpret a, b, and c as the side lengths of a triangle, this equation tells you the triangle is a right triangle with hypotenuse c. The most famous example is 345, because 32+42=9+16=25=52.

Pythagorean triples appear in many contexts:

Primitive vs. Non-Primitive Triples

A Pythagorean triple (a,b,c) is called primitive if the three numbers do not share any common factor greater than 1. In other words, their greatest common divisor (gcd) is 1. If gcd(a,b,c)>1, the triple is non-primitive.

You can obtain a non-primitive triple by taking a primitive triple and multiplying all three sides by the same integer k>1. For example, starting from the primitive triple 345:

Both 6,8,10 and (9,12,15) are still Pythagorean triples, but they are non-primitive because all three sides share a common factor (2 or 3, respectively). When you check the Primitive only box in the generator, it filters out these scaled versions, leaving just the "building block" triples.

Euclid’s Formula and How the Generator Works

A remarkable fact from number theory is that every primitive Pythagorean triple can be produced from a pair of positive integers m and n with the following conditions:

Given such a pair (m,n), Euclid’s formula defines a triple

a= m2 - n2 , b= 2mn , c= m2 + n2

The triple (a,b,c) defined in this way always satisfies a2+b2=c2, and the conditions on m and n guarantee that the triple is primitive. Every primitive Pythagorean triple can be obtained from exactly one such pair (m,n), up to swapping a and b.

The generator effectively runs through suitable (m,n) pairs, computes (a,b,c), and keeps only those with c less than or equal to your chosen maximum hypotenuse value. If the "Primitive only" option is off, the tool can also include multiples of these primitive triples, such as 6,8,10 from 345.

Worked Example with the Generator

Suppose you set the Maximum hypotenuse value to 30 and leave Primitive only checked. Behind the scenes, the tool searches for pairs (m,n) that generate triples with c30.

One such pair is m=4 and n=1. Using Euclid’s formula:

You can verify that

152+82=225+64=289=172,

so (15,8,17) is a valid Pythagorean triple. Because 15, 8, and 17 have no common divisor greater than 1, this triple is primitive, and it appears in the output as long as 17 does not exceed your chosen hypotenuse limit.

If you uncheck Primitive only, the generator can also show non-primitive multiples, such as

provided that the resulting hypotenuse (34 or 51) is still within your specified maximum. This is why the meaning of the "Maximum hypotenuse value" field is important: it always refers to the largest allowed value of c, regardless of whether the triple is primitive or not.

Interpreting the Inputs and Results

The form at the top of the page has two key controls:

In the results list or table, each row typically displays the three side lengths a, b, and c. Some implementations may also show additional information, such as whether the triple is primitive, or the (m,n) pair that generated it.

A few quick tips for using the results:

Comparison: Primitive vs. Scaled Triples

The following table illustrates how primitive triples act as templates for whole families of non-primitive triples. When you generate triples on this page, you will see the same pattern in the output, especially when you set a larger maximum hypotenuse and allow non-primitive triples.

Primitive triple Scaled by 2 Scaled by 3
3, 4, 5 6, 8, 10 9, 12, 15
5, 12, 13 10, 24, 26 15, 36, 39
7, 24, 25 14, 48, 50 21, 72, 75

In each row, the first triple is primitive. The other two are simple multiples, so they represent similar right triangles whose side lengths are scaled by a constant factor. When you interpret generator output, this helps you recognize when two triples describe the same basic shape at different sizes.

Applications and Use Cases

Pythagorean triple generators are useful in a range of practical and educational settings:

If you are working with other geometry tools, such as right triangle or distance calculators, these triples can provide quick exact test cases to compare against floating-point computations.

Limitations and Assumptions

Although the generator is designed to be accurate within the specified range, there are a few important limitations and assumptions to keep in mind when you choose parameters and interpret the output.

For most educational and exploratory purposes, choosing a moderate maximum hypotenuse and, if needed, restricting to primitive triples will provide fast, comprehensive, and easily interpretable results.

Enter a positive integer limit.

Embed this calculator

Copy and paste the HTML below to add the Pythagorean Triple Generator - Explore Integer Right Triangles to your website.