I finally took up your challenge, but with a slight twist. Instead of starting with X and generating Y and Z, I came up with a way to generate Pythagorean triples given just one counting number. This can easily be implemented on programmable calculators.
n in {1,2,3,4,...}
t = floor( (3+sqrt(8*n-7))/2 )
s = n -(t^2-3*t+2)/2
x = 2*s*t
y = t^2 -s^2
z = t^2 +s^2
{x,y,z} is a Pythagorean triple
examples:
1 -> {3,4,5}
2 -> {6,8,10} (a multiple of #1)
3 -> {12,5,13}
4 -> {8,15,17}
5 -> {16,12,20} (a multiple of #1)
t
6 |11 12 13 14 15
5 | 7 8 9 10 .
[ Figure 1 ] 4 | 4 5 6 . .
3 | 2 3 . . .
2 | 1 . . . .
1 | . . . . .
+-------------- s
1 2 3 4 5
More detailed explaination.
I recieved formulas from Jay McKinley
that show that any integer X > 2 can be in a Pythagorean triple.
X odd: Y = (X^2-1)/2, Z = (X^2+1)/2 X even: Y = (X^2-4)/4, Z = (X^2+4)/4
However, not all triples can be found this way, e.g. 20, 21, 29
Now if we wish to attempt to eliminate non-primitive Pythagorean triples (those not all divisible by any one number >1) then we need to eliminate the numbers that give an s-t pair that are both odd or both even, since such pairs produce Pythagorean triples that are divisible by 2. The pattern of elimination is like that of the squares of one color on a chess board. The sequence of numbers to choose from is then {1,3,4,6,8,10,11,13,15,17,19,21,22,24,26,28,...} where the pattern is 2 odd, 4 even, 6 odd, 8 even, etc. To further eliminate numbers that yield non-primitive Pythagorean triples requires inspection, since the rule is that s and t must be co-prime and not both odd and no elimination pattern could yield co-prime s and t pairs, at least none that could be encoded into a formula. Among those numbers already given, 13 is the only one that still results in s and t with a common factor greater than 1.
This should be entered by hand, as I use << and >> for angle brackets and -> for the single right-arrow character, and sqrt for the square root character. N.PYT
on the subject of solving for Z and Y from X or Z and X from Y
The formulas for X,Y, and Z in terms of S and T are set up so that X will always be even, and Y will always be odd (if you're using S and T co-prime and not both odd). So if you were handed an even number for X or Y, call it X and divide it by 2 then write out all the factorizations of the form X/2=S*T where S<T and S and T are >0. Then use those S,T pairs in the formulas for Y and Z. If you were handed an odd number, call it Y and set it equal to (T-S)*(T+S). write out all the factorizations of Y (where T-S<T+S ) and solve for S and T using (if p and r are the two factors, p<r) T=(p+r)/2 and S=(r-p)/2, then use that S,T pair in the formulas for X and Z. - Robert