Guten Abend Manfred,
sagen wir etwa prozedural
In[90]:= 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] := (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}}]]]
]
];
Partition[Flatten[o], 2]
]
Out[93]= {{4, 2}, {5, 2}, {6, 2}, {7, 2}, {8, 2}, {9, 2}, {10,
2}, {11, 2}, {12, 2}, {13, 2}, {14, 2}, {15, 2}, {16, 2}, {17,
2}, {18, 2}, {5, 3}, {6, 3}, {7, 3}, {8, 3}, {9, 3}, {10, 3}, {11,
3}, {12, 3}, {6, 4}, {7, 4}, {8, 4}, {9, 4}, {7, 5}}
Gruss nach Hamburg
Udo.
Jeder Ausdruck: x+y,x-y,x*y,x/y in Kombination mit (4,9,15,36) soll
berechnet werden.Wie lauten x und y?
Mein Ansatz:
FindInstance[x+y==a&&x-y==b&&x*y==c&&x/y==d&&1<x<=36&&1<y<=36&&1<a<=36&&1<b<
=36&&1<c<=36&&1<d<=36,{x,y,a,b,c,d},Integers,30]//Sort.
Die Antwort wird an 5.Stelle aufgelistet.Wie kann mann das besser
programmieren?
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/