Logo

MonoCalc

/

Pythagorean Triples Generator

Geometry
Largest hypotenuse c to search up to

About This Tool

Pythagorean Triples Generator – Find, Filter, and Verify Integer Right Triangles

A Pythagorean triple is a set of three positive integers (a, b, c) that satisfy the equation a² + b² = c², where c represents the hypotenuse of a right triangle and a, b are the two legs. The best-known example is (3, 4, 5), since 3² + 4² = 9 + 16 = 25 = 5². This tool lets you generate every triple up to a chosen limit, filter for primitive triples, verify any three numbers you already have, or build a triple directly from Euclid's formula.

Generating Triples Up to a Limit

The generator mode performs a brute-force search: it iterates every combination of legs a and b up to your chosen maximum value and checks whether a² + b² is a perfect square no larger than the square of the limit. Any combination that satisfies this condition is a valid triple. Because the search space grows quickly, the maximum value is capped at 10,000 to keep results near-instant in the browser.

Primitive vs. Non-Primitive Triples

A triple is called primitive when a, b, and c share no common factor greater than 1, meaning gcd(a, b, c) = 1. Every non-primitive triple is simply a primitive triple multiplied by an integer scale factor. For example, (6, 8, 10) is a non-primitive triple derived from the primitive triple (3, 4, 5) scaled by a factor of 2. The tool tags each result as primitive or non-primitive and shows the scale factor relating it back to its primitive parent.

Verifying a Custom Triple

If you already have three numbers and want to know whether they form a right triangle, use the verify mode. The tool sorts your inputs so the largest value is treated as the hypotenuse, then checks whether a² + b² = c². The step-by-step breakdown shows both sides of the equation so you can see exactly why a triple passes or fails, and classifies any valid triple as primitive or non-primitive.

Euclid's Formula

Euclid's formula is a classical method for generating Pythagorean triples directly from two parameters, m and n, where m > n > 0. The formula computes a = m² − n², b = 2mn, and c = m² + n². When m and n are coprime and their difference is odd, the resulting triple is guaranteed to be primitive. This parametric approach is how mathematicians prove that infinitely many primitive triples exist, and it offers a fast way to construct a specific triple without searching.

Counting Triples Without Listing Them

For large limits, you may only need to know how many triples exist rather than see the full list. The count mode runs the same search internally but only tallies totals, reporting both the total number of triples and how many of those are primitive, up to your chosen hypotenuse limit.

Why Pythagorean Triples Matter

Beyond their role in number theory, Pythagorean triples have practical uses. Builders and carpenters use the 3-4-5 triangle to check that corners are perfectly square without needing a protractor. Teachers use triples to design geometry problems with clean integer answers instead of messy decimals. Developers building games, simulations, or CAD tools sometimes need integer-based right-triangle dimensions for grid alignment or collision detection. Studying which integers can form a right triangle also introduces core ideas in number theory, including greatest common divisors and parametric equations.

Accuracy and Limitations

All calculations use exact integer arithmetic, so there is no floating-point rounding error in the pass/fail result for verification or in the generated triples. The generation and counting modes are capped at a maximum hypotenuse of 10,000 to avoid long-running computations in the browser; for research into much larger triples, specialized number-theory software is more appropriate.

Frequently Asked Questions

Is the Pythagorean Triples Generator free?

Yes, Pythagorean Triples Generator is totally free :)

Can I use the Pythagorean Triples Generator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Pythagorean Triples Generator?

Yes, any data related to Pythagorean Triples Generator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is a Pythagorean triple?

A Pythagorean triple is a set of three positive integers (a, b, c) that satisfy a² + b² = c², where c is the hypotenuse of a right triangle. The most famous example is (3, 4, 5).

How does this generator work?

Enter a maximum value and the tool searches for every integer combination where a² + b² = c² and c is within your limit. You can also verify a custom triple or generate one using Euclid's formula with parameters m and n.

What makes a triple 'primitive'?

A triple is primitive when a, b, and c share no common factor greater than 1 (gcd(a, b, c) = 1). Non-primitive triples are simply a primitive triple scaled up by an integer, such as (6, 8, 10) being (3, 4, 5) scaled by 2.

What is Euclid's formula?

Euclid's formula generates a Pythagorean triple from two positive integers m and n (with m > n, gcd(m, n) = 1, and m − n odd): a = m² − n², b = 2mn, c = m² + n². It always produces a primitive triple when these conditions hold.

Is there a limit to how large the numbers can be?

Yes, the maximum value is capped at 10,000 to keep the brute-force search fast and prevent the browser from freezing. For larger custom triples, use the verification mode instead.

Can I check if any three numbers form a right triangle?

Yes, use the Verify mode to enter any three positive integers. The tool checks whether a² + b² = c² and reports whether the result is a primitive or non-primitive Pythagorean triple.