# Pythagorean Triple Calculator

### Find Triples (A, B, C) Where B = nA + k

Pythagorean Triples (A, nA + k, C)

n = ,   k =

In a right triangle whose legs are A and B and whose hypotenuse of is C, the relation among the lengths A, B, and C is

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

When 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 (24, 45, 51) is another Pythagorean Triple, but it is not primitive because you can divide each element by 3, yielding the primitive triple (8, 15, 17). Every non-primitive set can be reduced to a primitive set.

For fixed integers n and k, you can often (but not always) find Pythagorean triples in which B = nA + k. For instance, if you choose n = 2 and k = -2, then the following six sets are the first several Pythagorean triples that satisfy the linear relation B = 2A - 2:

(3, 4, 5)
(16, 30, 34)
(105, 208, 233)
(715, 1428, 1597)
(4896, 9790, 10946)
(33553, 67104, 75025)

As the ratio of B to A approaches 2, the ratio of C to A approaches sqrt(5). This means the ratios C/A provide better and better approximations to sqrt(5). Observe,

sqrt(5) = 2.236067977..., and
75025/33553 = 2.23601466...

If we choose n = 1 and k = 1, then the first six triples for which B = A + 1 are

(3, 4, 5)
(20, 21, 29)
(119, 120, 169)
(696, 697, 985)
(4059, 4060, 5741)
(23660, 23661, 33461)

In these sets, as the ratio of B to A approaches 1, the ratio of C to A approaches sqrt(2). And so the fractions C/A and C/B provide better and better approximations to sqrt(2):

sqrt(2) = 1.41421356..., and
33461/23660 = 1.41424344..., and
33461/23661 = 1.41418367...

An even more accurate approximation for sqrt(2) is (A+B)/C:

(23660+23661)/33461 = 1.41421356...