Two prior posts were made about
Pythagorean Triples and an algorithm for producing triples (Part I, Part II).
I recently came across two additional algorithms for producing Pythagorean triples.
For reference my earlier
post gave the first algorithm:
Let
n and m be any positive integers where n>m. The Pythagorean Triple generated
is formed by the numbers:
2nm
n2 - m2
n2 +m2
Below is another method.
Start with any odd number and
square it.
Example: start with 3; 3x3 = 9
Next, find the two consecutive
numbers that add up to the square of the starting number.
In this example, 4 + 5 = 9
The starting number, 3, and the
two consecutive numbers, 4 and 5, will be a Pythagorean Triple (3,4,5).
Here’s another example:
Start with the odd number, 5.
Square it: 25
Find the two consecutive numbers
that add up to 25: 12 and 13
The Pythagorean Triple is (5, 12,
13)
Next is a third method which
starts with any multiple of 4.
Example: 8
Take half of the starting number, 8 --> 4
Square this result, 4x4 = 16
Finally, use the two odd numbers
immediately before and after this square: 15, 17
These two odd numbers and the
original starting number will be a Pythagorean Triple (8, 15, 17)
One may use this method with even starting numbers that are not multiples of 4; however, the Pythagorean Triples produced can be reduced by a common denominator and will be found to be similar to a primitive triple. A primitive triple is one that cannot be reduced. For example, starting with 6; square half of 6 to get 3x3 = 9; use the numbers immediately before and after to get 8 and 10. The triple (6,8,10) is similar to the triangle (3,4,5). So, if you are trying to produce primitive triples, starting with multiples of 4, one will get triples that are irreducible triples.
Here is a link to a spreadsheet I
made for these different Pythagorean Triple generators: Pythagorean generator.
Pythagorean Triples can also be found in the Online Encyclopedia of Integer Sequences: A001844 - OEIS
Reference: I read about these two additional Pythagorean Triple generators in the book Geometry for dummies by Mark Ryan.
The site Math is Fun has good illustrations and further information on triples: Pythagorean Triples - Advanced (mathsisfun.com)
Additional formulae for producing triples are found on Wikipedia.
More interesting facts about Pythagorean Triples on Dr Ron Knott's archive.