Der Quotient d soll ganz sein, daher
In[119]:= Clear[fS, fA]
fS[L_Integer, x_Integer, y_Integer,
R_Integer] := (L < x + y < R && x y < R);
fA[L_Integer, x_Integer, y_Integer,
R_Integer] := (IntegerQ[x/y] && L < x - y < R && L < x/y < R);
With[{L = 1, R = 37},
o = {};
For[i = L + 1, i < R, i++,
For[j = i, j < R, j++,
If[fS[L, i, j, R],
If[fA[L, i, j, R], o = {o, {i, j}},
If[fA[L, j, i, R], o = {o, {j, i}}]]]
]
];
Sort[Partition[Flatten[o], 2]] /. {x_, y_} -> {{x, y}, x + y, x - y,
x y, x/y}
]
Out[122]= {{{4, 2}, 6, 2, 8, 2}, {{6, 2}, 8, 4, 12, 3}, {{6, 3}, 9, 3,
18, 2}, {{8, 2}, 10, 6, 16, 4}, {{8, 4}, 12, 4, 32, 2}, {{9, 3},
12, 6, 27, 3}, {{10, 2}, 12, 8, 20, 5}, {{12, 2}, 14, 10, 24,
6}, {{12, 3}, 15, 9, 36, 4}, {{14, 2}, 16, 12, 28, 7}, {{16, 2}, 18,
14, 32, 8}, {{18, 2}, 20, 16, 36, 9}}
mit 0.016 Sek. im Vergleich zu FindInstance (1.718 Sek.) 107 mal so
schnell.
Grus++ nach Hamburg
Udo.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/