# Pythagorean Triple Calculator

### Find All Triangles with a Given Leg Length

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

*A*^{2} + *B*^{2} = *C*^{2}, or

sqrt(*A*^{2} + *B*^{2}) = *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)

*N*. To make the calculation, first express

*N*as a product of its prime factors:

*N*= 2

^{a0}·

*p*

_{1}

^{a1}·

*p*

_{2}

^{a2}···

*p*

_{k}

^{ak},

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)·[|2

*a*

_{0}- 1|·(2

*a*

_{1}+ 1)·(2

*a*

_{2}+ 1)···(2

*a*

_{k}+ 1) - 1]

The absolute value ensures that if

*a*

_{0}= 0, then the first term in the product is 1 rather than -1. For example, take the number 175, which breaks down as

175 = 2

^{0}·5

^{2}·7

^{1}.

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)

© *Had2Know 2010
*