Pythagorean Triple Calculator

Find All Triangles with a Given Leg Length

Pythagorean Triple Calculator

Enter the leg length of the right triangle:

If a right triangle has legs of length A and B and a hypotenuse of length C, then the relation among A, B, and C is

A2 + B2 = C2, or
sqrt(A2 + B2) = C

If A, B, and C happen to be integers, the set (A, B, C) is called a Pythagorean Triple. The first few Pythagorean Triples are

(3, 4, 5)
(5, 12, 13)
(8, 15, 17)
(7, 24, 25)
(20, 21, 29)

These examples are called primitive triples because the three numbers in each set do not share common factors. The set (18, 80, 82) is another Pythagorean Triple, but it is not primitive because you can divide each element by 2, yielding the primitive triple (9, 40, 42). Every non-primitive set can be reduced to a primitive set.

For every positive integer N greater than 2, there exists at least one Pythagorean triangle with a leg of length N. For example, there are seven Pythagorean right triangles that have one leg of length 24:

(7, 24, 25)
(10, 24, 26)
(18, 24, 30)
(24, 32, 40)
(24, 45, 51)
(24, 70, 74)
(24, 143, 145)

The first and last sets are primitive triples, the others can be reduced to primitive triples by dividing out the common factor. There is a formula to compute the number of Pythagorean triangles that have one leg of length N. To make the calculation, first express N as a product of its prime factors:

N = 2a0·p1a1·p2a2···pkak,

where the p's are prime factors not equal to 2. Then the number of triangles with a leg of length N is

(1/2)·[|2a0 - 1|·(2a1 + 1)·(2a2 + 1)···(2ak + 1) - 1]

The absolute value ensures that if a0 = 0, then the first term in the product is 1 rather than -1. For example, take the number 175, which breaks down as

175 = 20·52·71.

The number of Pythagorean triples with a leg length of 175 is

(1/2)[(1)(5)(3) - 1] = (1/2)(14) = 7.

The triples are

(60, 175, 185)
(175, 288, 337)
(175, 420, 455)
(175, 600, 625)
(175, 2184, 2191)
(175, 3060, 3065)
(175, 15312, 15313)