10 for T=2 to 999999
20 for X=1 to int(T/2)
30 Y=T-X
40 Fx=!(X):Fy=!(Y)
50 Z2=Fx*Fy-Fx-Fy
55 if Z2>=0 then
60 :Z=int(sqrt(Z2)+0.5)
70 :if Z*Z=Z2 then print X;Y;Z
80 next
90 next
which stopped by overflow when the total of X and Y reached 1004, so higher totals weren't checked
finds only
(2,2,0) and (2,3,2)
The former contains a zero and so doesn't fulfill the "positive" requirement.
The latter solution also leads to (3,2,2); the program looked only for X<=Y, but of course the result is symmetrical.
|
Posted by Charlie
on 2014-03-23 10:19:54 |