# A perfect solution to 24s

In several recent posts, I have discussed a method for perfect solution to the game of 24s. Here, I summarize some of those results and link to the Mathematica notebook I used to find them, and a comprehensive list of solutions for those who would like to skip the math and get right to the answer.

To recap, there are 715 possible hands in a game of 24s. 566 of those hands can be solved with arithmetics alone, 595 if we add roots, powers, and logs, and 619 if we add Mod.

I generally play with Log and Power and Root allowed, but not Mod. I find that the hands that are solvable only with Log, Power, and Root, generally are solvable by humans. See for example

{1,1,8,9} -> 8 Root[9,1+1]
{1,2,9,9} -> (9-1) Root[9,2]
{2, 2, 2, 6} -> 2^(2+Log[2,6]) or (2*Root[6,2])^2
{2,2,9,9} -> 2(Root[9,2]+9)
{3,7,8,10} -> 7 Root[8,3] +10
{3,4,9,10} -> 4+Log[3,9]*10
{7, 8, 9, 9} -> 8 Root[9,9-7], and
{8, 8, 9, 10} -> 8 Root[9,10-8].

A bright high school student should be able to find any of those. However, Mod introduces solutions that would probably never be played by an unaided human being. For example,

{5, 6, 7, 10} -> 6*Mod[7^10,5], and

{5,7,7,8} -> 8*Mod[7^7,5].

There is no other solution in these two cases.

Anyway, I’ve provided a comprehensive list of solutions linked as RTF and PDF documents, and the Mathematica notebook that I used to solve the problem in the first place.

And, most importantly, the Mathematica notebook.

Let me know if you do anything interesting with this.