Pythagorean Triples Generator
Generate primitive Pythagorean triples (a, b, c) with a² + b² = c².
Find triples up to a chosen hypotenuse and check whether three integers form a triple.
Pythagorean Triples
A Pythagorean triple is a set of three positive integers (a, b, c) such that:
a² + b² = c²
These are integer-sided right triangles. The most familiar example is (3, 4, 5): 9 + 16 = 25.
Primitive vs Non-Primitive
A triple is primitive if gcd(a, b, c) = 1 — that is, the three values share no common factor. Every triple is a primitive triple multiplied by some positive integer:
(3, 4, 5) → (6, 8, 10), (9, 12, 15), (12, 16, 20), …
Euclid’s Formula — Generating All Primitive Triples
For coprime integers m > n > 0 with one even and one odd:
a = m² − n² b = 2 × m × n c = m² + n²
This produces every primitive Pythagorean triple exactly once.
| (m, n) | (a, b, c) |
|---|---|
| (2, 1) | (3, 4, 5) |
| (3, 2) | (5, 12, 13) |
| (4, 1) | (15, 8, 17) |
| (4, 3) | (7, 24, 25) |
| (5, 2) | (21, 20, 29) |
| (5, 4) | (9, 40, 41) |
| (6, 1) | (35, 12, 37) |
| (6, 5) | (11, 60, 61) |
| (7, 2) | (45, 28, 53) |
Famous Triples
The earliest evidence for Pythagorean triples comes from Babylonian tablet Plimpton 322 (c. 1800 BCE), which lists 15 triples — over 1000 years before Pythagoras. The modern proof of Euclid’s formula appears in Elements, Book X.
Properties
| Property | Statement |
|---|---|
| At least one of a, b is divisible by 3 | Always true |
| At least one of a, b is divisible by 4 | Always true |
| At least one of a, b, c is divisible by 5 | Always true |
| Exactly one of a, b is odd | True for primitives |
| c is always odd | True for primitives |
| Inradius | r = (a + b − c) / 2 — always an integer |
Worked Example — Verify (20, 21, 29)
20² + 21² = 400 + 441 = 841 = 29² ✓ This is a primitive triple from m = 5, n = 2:
- a = 25 − 4 = 21
- b = 2 × 5 × 2 = 20
- c = 25 + 4 = 29
Modern Uses
| Field | Use |
|---|---|
| Construction | Right-angle layout with measuring rope |
| Surveying | Squaring large rectangular plots |
| Cryptography | Underlying number-theory exercises |
| Computer graphics | Discrete pixel right triangles |
| Recreational math | Fermat’s Last Theorem (its negative cousin) |
Connection to Fermat’s Last Theorem
Fermat’s Last Theorem states there are no triples of positive integers (a, b, c) with aⁿ + bⁿ = cⁿ for n ≥ 3. For n = 2 the count is infinite — that is the entire content of this calculator. For n ≥ 3, Andrew Wiles proved in 1994 that none exist.