Posted by: anthonygenello | October 3, 2008

## The Game of 24

I noticed that the class enrollment number is 24. This reminds me of a math game called the game of 24. It’s popular in Pennsylvania high school math competitions. It’s also played in areas of Jersey and New York but for some reason it never caught on outside of the mid-Atlantic region. Anyway, here are the rules and procedures of the game:

1. Remove the face cards (jacks, queens, and kings) from a standard deck of cards and shuffle the remaining 40 cards.

2. Deal four cards face up.

3. Using all of the digits of the 4 cards, create an arithmetic expression with operations of addition, subtraction, multiplication, and division that is equivalent to the number 24. Parentheses can be used and the numbers can be reordered in order to manipulate the order of operations. For example (8 – 6 / 3) * 4 =24.

4. Usually, two teams race against each other and points are awarded to teams whose members shout out a correct arithmetic expression first.

I’ve played this game several times at high school competitions and was okay at it. I heard rumors, though,  that some teams memorized a solution for all possible “hands” of the game. To see just how hardcore this is, we can use combinatorics to count the number of possible hands that one may face. Combinations are counted rather than permutations because players can alter the order of the digits. One must also be careful about allowing for repeats in the deck. There is a convenient formula for this calculation. Instead of using 10 choose 4 we must us (10 + 4 – 1) choose 4 since there are 10 distinct digits and we will be choosing 4 out of those 10, some which may be repeats. The formula is listed on wikipedia (http://en.wikipedia.org/wiki/Combination) but I haven’t been able to find a derivation. If we calculate 13 choose 4, the result is 715. That seems like way too many to memorize. Granted some of the combinations, such as 1, 1, 2, 3 do not have a solution. Some, however, have multiple solutions.

Some 24 enthusiasts have actually written programs to solve the game of 24 for any possible hand. Here is an example of one such program: http://scripts.cac.psu.edu/staff/r/j/rjg5/scripts/Math24.pl.

## Responses

1. Ha, way to bring out the math nerdism in all of us. I might add that this game (sort of) caught on in WV as well, though the deck was smaller and the aim was 10 or 16 or something not nearly as cool as 24.

I was thinking about how you/wikipedia ingeniously arrived at $13 \choose 4$ as the total number of ways to pick the four cards, so I pulled up an unfortunate statistics midterm from last year. Credits to Prof. Joe Blitzstein for the following:

Basically, we look at each possible hand of four cards in terms of how many of each number (Ace-10, since face cards are removed) occurs. Then the problem we have is finding all possible sets of $x_n$ such that $x_1+x_2+...x_{10}=4$, where $x_1$ is the number of Aces in the final hand of four, etc. Of course, the $x_n>=0$.

It turns out that Bose and Einstein devised a formula for this, namely: ${n+r-1} \choose {r}$; in this case, ${10+4-1} \choose 4$. The intuition behind this has to do with each $n$ being a shoebox and tossing $x$ into them, or placing popsicle sticks between them, etc., so if anyone is very interested, just Google “Bose-Einstein statistics” and you should find it eventually.

Thanks for the math-nerd memories. Ciao.

2. Bose-Einstein statistics have to do with counting the ways of having indistinguishable bosons in different energy states (like having four cards — indistinguishable means order doesn’t matter — showing different numbers).

I wouldn’t say Bose and Einstein ‘devised’ the formula ${n+r-1}\choose{r}$, since it is a solution to a general combinatorial problem that existed in many places (and was solved) before they applied it to bosons. But they did use it in a very important way.

By the way, everyone, it’s not too too hard to derive the formula: spend a little time thinking about it and see if you can get it. I’ll explain it to you if no one else can get it and explain it first. It’s hard to give a hint, but with combinatorial things, think about alternate ways of describing the same problem. The way I think of it is this: can you restate the problem so that you are making a choice of n-1 things from among (n-1)+r things? It may be easier to think of in terms of bosons than playing cards. But everyone will have a different way to see it, so these hints may be misleading.

By the way, we used to play 24 back in high school at PROMYS, a number theory camp for high school students. I was always very bad at it. There’s also a commercial version of the game (since it only requires a deck of cards, the commercial game added in some gimmicks like square roots). I wasn’t any good at it (I still can’t do arithmetic), but it was a huge hit at PROMYS, along with Bughouse (a sort of speed two-way chess). I preferred the Number-Colour Game, which goes like this: each player takes a turn, in which he can say either a number or a colour. If you say a colour, you lose. You wouldn’t believe how amusing this is if you’re a high school math nerd.