Previously

I first played 24 the math game in 1984, I think.  The way we played was that we randomly pull out 4 poker cards and winner takes back all the 4 cards.  The one with all the cards at the end wins the game.  So it’s great for 2 or 4 players, we need to modify the rule at the end when less than 4 remain in the game.

It is a great way to draw kids into maths, science and other good stuff.

Fast forward to 2009, my then girlfriend and I played again to kill some time in boring New York. As someone with some street credit in maths, I found myself constantly beaten by my girlfriend. Frustrated, I decided to code up some perl script to solve the game for me. This was hosted on ocf.berkeley.edu. Not satisfied with the original solver which only gives a solution (1x2x3x4 for the quadruple {1,2,3,4}),  I coded up a script to give all possible solutions with some redundancies reduced: (3+2+1)×4,  (4+2)×(3+1) and 1x2x3x4.

Note: given  1x2x3x4,  4x3x2x1 is considered a redundant solution.

There are still more work to be done. For example, given quadruple {1,3,6,10}, my current solver gives 3 solutions: 10×3×1-6,  10×3-6×1, (10×3-6)×1.

They look different topologically, but they are all just 10×3×1-6.