Pythagorean Triple Generator
List primitive Pythagorean triples (a, b, c) with c ≤ N.
Overview
The Pythagorean Triple Generator lists every primitive triple (a, b, c) with hypotenuse c <= N. A primitive triple is one whose three integers share no common factor, like (3, 4, 5) or (5, 12, 13).
It is built for geometry students exploring number theory, puzzle creators sourcing exact right triangles and developers seeking elegant integer test data. The generator uses Euclid's formula, so there are no false positives and no duplicates.
How it works
Euclid's formula says every primitive triple comes from coprime integers m > n > 0 of opposite parity via a = m^2 - n^2, b = 2 * m * n, c = m^2 + n^2. Iterating over valid (m, n) with c <= N enumerates all primitives exactly once.
For each generated triple the calculator sorts (a, b, c) in ascending order and skips any where m and n are both odd or share a factor (those give non-primitive triples). Multiplying every entry by a positive integer produces non-primitive triples that aren't listed but are easy to derive.
Examples
N = 30 → (3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), (20, 21, 29)
N = 100 → 16 primitive triples
First few: (3,4,5), (5,12,13), (8,15,17), (7,24,25), (20,21,29), (9,40,41), (12,35,37), (11,60,61)
FAQ
What does primitive mean?
The three integers share no common factor greater than 1. (3, 4, 5) is primitive; (6, 8, 10) is not (everything's divisible by 2).
Are there infinitely many?
Yes. Euclid's formula generates arbitrarily large primitives by picking larger m.
Why list only primitives?
Because every Pythagorean triple is a multiple of a primitive. Listing primitives shows the underlying structure without redundancy.
Why is one leg always even?
In any primitive triple, exactly one of a and b is even and the other is odd. The hypotenuse is always odd.
Is (0, 0, 0) a Pythagorean triple?
Trivially yes, but it's excluded by the requirement that legs be positive integers.