Let N be defined by N=> 3*1*4*1*5*9*2, where each asterisk may be replaced by any basic arithmetic sign (
+, - ,* ,/) and
=> means that the result is obtained by calculating sequentially from left to right.
Examples:
3+1+4+1+5+9+2=>25; 3+1-4+1-5+9-2=>3; 3*1-4*1-5+9-2=>1 etc.
How many distinct positive integer results can be obtained?
What is the lowest positive integer that cannot be obtained?
What positive integer claims the highest quantity of distinct expressions?
Rem: No brackets allowed.
(In reply to
re: piece of cake (solutions?) by Charlie)
BTW, the most likely to be missed in a counting program is the last one, 1530, as its count has to be printed out outside the main loop, as a built-up total whose printing is not triggered by a new value.
3+1*4+1*5*9*2 = 1530
|
Posted by Charlie
on 2010-12-07 19:32:44 |