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
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?)
I did not have a counter in my program, since I wanted to see the actual calculations which qualified: I allowed 9999v9999, but considered that perhaps that was not enough precision to exclude some that may have been "close" to being integer results. From your list, I think you would agree that 2 and 35 answered the other specs.
I compared your list with mine, and they matched except that I did not find the value 200 at all (your list shows you found one occurrence). May I ask which expression yielded that result?
The expression for 200 would be 3 + 1 * 4 + 1 + 5 * 9 + 2. I used the editor to sort and weed, and must have deleted this one in error when I was pruning the list of 4096.
Edited on December 7, 2010, 8:12 pm