Pythagorean triples numbers generator

Pythagoras triples summary



For example, the set a = 3, b = 4, c = 5 are a Pythagorean triple.
One method to find these triple values is by using Euclid's formula. This formula expresses the sides a, b, and c in terms of two integers, m and n , where m > n > 0 (see example bellow)..

Where k is a positive integer (k=2,3,4,…). If m − n is odd, k=1, and m and n are coprime (meaning they have no common factors other than 1), then the generated Pythagorean triple is primitive.

Verification of Euclid's formula












Notice that the values of m and n should be: m > n > 0

Euclid's formula with n = 1

Example 1 - Right triangle sides calculation

The solution of this question is a Pythagorean triple number, the development of the resulting numbers can be found in equation (5).
We can assume that n is equal to 1, this case yields the shorten Pythagorean triple numbers, see the equations above.
The sides are defined by the integer number m, and is equal to:
And the sides of the triangle will be 8, 15 and 17 (these numbers are Pythagorean triple numbers).
Because the values of sides a and be are interchangeable side b can also be equal to 8, in this case we get:

a = 2m = 2 * 3 = 6
c = m2 + 1 = 9 + 1 = 10
In this case, the sides are 6, 8, and 10. Notice that this is not a primitive Pythagorean triple because (k = 2). The corresponding primitive triple is obtained by dividing each side by (k), giving the values 3, 4, and 5.
