Question:
(34 O 5 O 6 O 8 O 9 O 1) O 2=2008
Replace the Symbol of "O" to "+" or "-" or "*",and make the expression is true.
My solution:
info = {{"+"}, {"-"}, {"*"}};
For[a = 1, a < 4, a++,
For[b = 1, b < 4, b++,
For[c = 1, c < 4, c++,
For[d = 1, d < 4, d++,
For[e = 1, e < 4, e++,
For[f = 1, f < 4, f++,
temp = StringJoin["(34", Part[info, a], "5", Part[info, b], "6",
Part[info, c], "8", Part[info, d], "9", Part[info, e], "1)",
Part[info, f], "2"];
If[ToExpression[temp] == 2008, Print[temp]]
]
]
]
]
]
]
The results:
(34*5*6-8-9+1)*2==2008
O
also meant for +/-? You use*
there... $\endgroup$