As you know, the value of pi
with some decimals is 3.141592653589...
Write an expression using all digits (0-9) once each, to achieve the closest
value to pi
. The digits must be in the order 1, 2, 3, 4, ...8, 9, 0. You may also use as many parentheses, +, -, /, and *, as you wish, but only these symbols.
As an example: 123/45 - 6/7 + 8/9 + 0 = 2.765079... gives a difference of approximately 0.376.
You may post the difference or the approximation you achieve in the subject of your comment.
(In reply to My mistake!
If that is the limitation, and "as many parentheses", etc. "as you wish" really means as many choices, but only at most one each, then a small modification to the program to allow only non-repetitions, produces 1/(234+56-7)*890 = 3.14487632508834, where the standard mathematical usage is followed, where multiplication does not take precedence over division.
Posted by Charlie
on 2005-09-26 18:19:29