create cursor crsI (i i) for xi=3 to 800 insert into crsI values (xi*xi) endfor INDEX ON i TAG i select a.i as hypo, b.i as cath1, c.i as cath2 ; from crsI a, crsI b, crsI c; WHERE a.i>b.i AND b.i>c.i AND a.i=b.i+c.i ; into cursor crsPythagora SELECT CAST(SQRT(hypo) as int) as hypo; , CAST(SQRT(cath1) as int) as cath1; , CAST(SQRT(cath2) as int) as cath2; FROM crspythagora ; INTO CURSOR crsTriangles INDEX ON hypo TAG hypo browseThe first condition in the where clause is there for speed's sake - we don't want Fox to even try combinations where the hypotenuse would be shorter; the second is to cut the result in half by eliminating 5, 3, 4 if we already have 5, 4, 3; and the third one is what takes the cake, that's Pythagora's rule. The rest is the icing on that cake.
Hypo Cath1 Cath2 5 4 3 10 8 6 13 12 5 15 12 9 17 15 8 20 16 12 25 24 7 25 20 15 26 24 10 29 21 20 30 24 18 34 30 16 35 28 21 37 35 12 39 36 15 40 32 24 41 40 9 45 36 27 50 48 14 50 40 30 51 45 24 52 48 20 53 45 28 55 44 33 58 42 40 ...and 655 more.