Pythagorean Triples
|
02-09-2017, 05:42 AM
Post: #1
|
|||
|
|||
Pythagorean Triples
Criteria
The program PYTHA calculates a Pythagorean triple. A Pythagorean triple is a set of three positive integers A, B, and C that represent the lengths of a right triangle, with C being the hypotenuse. Hence, A^2 + B^2 = C^2. Pythagorean triples can be generated with three arbitrary positive integers M, N, and K with the following criteria: 1. M > N 2. M and N are coprime. That is, gcd(M, N) = 1 (gcd, greatest common denominator) A, B, and C are generated by: A = K * (M^2 – N^2) B = K * (2 * M * N) C = K * (M^2 + N^2) Code: EXPORT PYTHA(M,N,K) Source: “Pythagorean Triple” Wikipedia. Last Modified February 7, 2017. https://en.wikipedia.org/wiki/Pythagorean_triple Accessed February 7, 2017 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Pythagorean Triples - Eddie W. Shore - 02-09-2017 05:42 AM
RE: Pythagorean Triples - Dieter - 02-09-2017, 08:49 AM
RE: Pythagorean Triples - Joe Horn - 02-09-2017, 02:49 PM
RE: Pythagorean Triples - Dieter - 02-09-2017, 08:57 PM
|
User(s) browsing this thread: 1 Guest(s)