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.