Here is a script in Python that exhaustively calculates all values, then spits out the formulas for the 1900-2100 range:  <a href="http://pastie.org/777044" rel="nofollow">http://pastie.org/777044</a><p>The code is about 30 lines and runs in under seven seconds on my machine.<p>It works by splitting the list of numbers into all possible sets of two sublists, recursively calculating the possible values of expressions for each sublist, then merging the expression values together using each possible operator.<p>I think this approach runs faster than the Java/Lisp solutions because it can collapse equal-valued subtrees together, which helps particularly when you have a subtree that consists only of additions, multiplications, or divisions.<p>(Edit: It also caches the value set of each subtree, which probably helps even more.)