Pythagorean Triples Generator

Generate Pythagorean triples using Euclid's formula. Find primitive and non-primitive triples up to any maximum value.

Generate Triples

Result

Triples Found
--
triples

Step-by-Step Solution

a = m² - n², b = 2mn, c = m² + n²

What Are Pythagorean Triples?

A Pythagorean triple consists of three positive integers (a, b, c) such that a² + b² = c². The most well-known example is (3, 4, 5), since 9 + 16 = 25. These triples represent the integer-sided right triangles.

Euclid's Formula

The Formula

For integers m > n > 0:

a = m² - n²
b = 2mn
c = m² + n²

Primitive Triples

A triple is primitive if gcd(a, b, c) = 1. This occurs when m and n are coprime and not both odd.

gcd(m, n) = 1 and m - n is odd

Non-Primitive Triples

Multiply any primitive triple by k to get non-primitive triples.

(ka, kb, kc) for k = 2, 3, ...

Properties of Pythagorean Triples

  • In every Pythagorean triple, at least one of a or b is even.
  • In every primitive triple, exactly one of a or b is even.
  • The hypotenuse c is always odd in a primitive triple.
  • There are infinitely many Pythagorean triples.
  • Every primitive triple can be generated by Euclid's formula with appropriate m and n.

Famous Pythagorean Triples

  • (3, 4, 5) -- The smallest and most famous triple.
  • (5, 12, 13) -- Generated by m=3, n=2.
  • (8, 15, 17) -- Generated by m=4, n=1.
  • (20, 21, 29) -- Nearly isosceles right triangle.