Card Game 24
learn math the fun way

Mobile version

To play the game, either click the  Deal  button, or enter any four numbers, preferably positive integers between 1 and 13. Then think of a caculation using addition, subtraction, multiplication and/or division to get the number 24. Click the  Show Answer  button to show "all" possible calculations.

Click
or enter numbers





Force reorder (What's this?)

History Many years ago, three out of four Chinese were farmers and most of them were undereducated. Yet they all have remarkable talent in mental arithmetic; they can tell you the answers for 72/2+83 or 3.8*2.5 almost instantly, sometimes even faster than an abacus (ancient Chinese "calculator"). When I was a kid, I got trained by a Chinese poker card game called twenty-four. Not sure if this game contributed to the Chinese farmers' math talent, but the popularity of it among all young people attests to the truth that most Chinese are good at arithmetic.

The game goes like this. Four people each show one card. You think of a calculation with addition, subtraction, multiplication and division on the numbers shown on the cards to get 24. Card Ace is 1, Jack 11, Queen 12, King 13, excluding big and small Jokers. Whoever comes up with the answer first wins that round. For instance, if the cards are 3, 4, 1, and 9, you can say 3*(4+1)+9 (* here means multiply). Obviously, if you are or your kid is a third- or fourth-grader in school, this game has some educational value.

Programming A friend of mine told me that recently (Feb 2004) he wrote exactly the same program, except in VBA for Excel. His program also did an exhaustive computation and concludes that with four positive integers 1 through 13, 88% of the time you should get an answer (i.e. 12% of the time you can't get 24 with any calculation.) But neither of our programs is perfect. For instance, my program shows 1*2*3*4 together with (1*2*3)*4 and others while they are mathematically the same calculation; ideally only one of them should be shown. Jesse Hull emailed me and said his program, written in Java, "accounts for the algebraic differences". For simplicity, my program also does not consider different orders of input numbers unless it doesn't find an answer without changing their order (you can override this behavior by checking Force reorder).

Links If you don't feel challenge playing this game of twenty-four, take a look at my game of forty-eight. (You can change it to any arbitrary number in a matter of minutes if you're comfortable with Javascript.) Or for a younger kid, the game of twelve may be more appropriate. A number of people on the Internet have done similar work, such as Twenty-Four Game at PA HOMESCHOOLERS, Dr. WuWu's Catch 24 and Dr. Math's summary Math in Card Games.

Update 2012-02 I came across the 24 Game Wikipedia page. It has a nice description of this game, history, theory, and online resources, not including mine though! (Since my game was written in early 2004, it may be the earliest online. And since it uses Javascript, it can be played with no Internet connection other than the initial page download.) It's interesting to know that the game started in the 1960's or earlier in Shanghai. I personally played it in early 1970's in Chongqing.

Update 2013-09 The owner of 4 Numbers emailed me about his web site. He did a good job in popularizing this game and organizing people interested in playing it.

To my Miscellaneous Page