Author: Joe Horn PYTH: A Primitive Pythagorean Triangle generator. Place two integers on the stack and run PYTH. A list { A B C } will be returned containing the lengths of the sides of a right triangle. A right triangle is considered "Pythagorean" if the lengths of all three sides are integers. (The 3-4-5 and 5-12-13 right triangles are the smallest, and are familiar to all math students. There are infinitely many more.) PYTH will always return a Pythagorean triangle. A Pythagorean triangle is considered "primitive" if the lengths of all three sides are relatively prime (that is, there are no factors shared between any two of them). For example, the 104-153-185 right triangle is primitive because 104, 153 and 185 share no common factors. PYTH will return a primitive Pythagorean triangle if (a) the two numbers you give it are (a) relatively prime, and (b) one of them is even. For example, 77 and 52 (relatively prime, and 52 is even) yield the 3225-8008-8633 primitive Pythagorean triangle. To check relative primality, run GCD (Greatest Common Divisor); if it is 1, then the two numbers were relatively prime. While I was at it, I threw in LCM (Least Common Multiple) and RDC (Reduce). RDC removes the common factors from two integers, thus reducing them to two relatively prime numbers. If X and Y are the inputs, and { A B C } is the output of PYTH, the formulas that relate them are: A = ABS( X^2 - Y^2 ) B = 2 * X * Y C = X^2 + Y^2 Notice that these equations are nowhere in the program... -jkh-