Making 24

Random number: 17

3rd January 2017

In the morning, I had a lot of fun making a gravity simulator. It was actually super easy this time round; because I've been playing around with gravity simulation for ages, but each time I never actually carry the project through the whole way; 2 or 3 hours (I think?) did the trick. As usual, I kept getting really really mediocre bugs though (like thinking that \(F = a\) instead of \(F = ma\)...)

On the train to Florida, I played a game of 24 with my relatives. Basically how the game works is that you shuffle a deck of cards (with the royal cards removed) and then reveal the top four cards of the deck. Then you try and make 24 with the four numbers, using only the basic operations (addition, subtraction, multiplication, division) with bracketing and rearrangement of the cards allowed. You have to use all the numbers exactly once.

So I decided to write a program to see which sets of numbers were 'bad'; in the sense that no combination of the four numbers can generate 24. You can see the set here. There are 150 entries in total. Playing around some more, I found out that dealing a set of four random cards has an ~87% chance of being solvable. If you include the royals, and say that all the royals have a value of 10, then this percentage drops down to ~83% (understandable, as tens are hard to use).

There are also subsets of the deck which you can draw any four cards from and are guarenteed that you can solve for 24. The largest of these subsets are of size 13, and are listed below:

Deck 1: two 2's, four 3's, four 6's, one 8, one 9, one 10.
Deck 2: two 2's, four 3's, one 5, four 6's, one 9, one 10.
Deck 3: three 2's, four 4's, two 5's, three 8's, one 10.

A further question is: what if the game were not 'make 24', but 'make \(n\)' for some other \(n\)? Is \(24\) actually the easiest number to make? Turns out \(24\) is by no means the easiest number to make:

where the \(y\) axis is the probability 4 randomly drawn cards will be able to make the target number, and the \(x\) axis represents the different target numbers. Actually, \(2\) is the easiest number to make (from this limited range). There are only a handful of sets of numbers that cannot create \(2\): [[1, 1, 1, 7], [1, 1, 1, 8], [1, 1, 1, 9], [1, 1, 1, 10], [1, 7, 10, 10], [2, 5, 7, 10]].