The Card Game of 24


Please enter four integer values between 1 and 24 inclusive. This program will return all expressions using the four operators +, -, * and / that use each value exactly once and that have the result 24. There may be a lot of what looks like duplicates, but they are actually different ways of rearranging the numbers. (This program can actually handle all integers.)

Value 1: Value 2: Value 3: Value 4:









About 24:

The basic game of 24 is generations old. It has been played in Asian countries, in particular China, since at least the mid-20th century. There, it was usually played with regular playing (poker) cards and using numbers from 1 (aces) through 13 (kings). Robert Sun created a variant of the game that used specialized cards with four numbers per card, each of which is guaranteed to have a solution. He also created other variations and markets it in the USA with his company Suntex (http://www.24game.com/) as a teaching tool and for competition among elementary school students. Their website begins the description of the game as follows:

Mathematically, the game comes out of number theory, specifically the theory of "abundant numbers". An abundant number is one for which the sum of its divisors are greater than the number itself. So, Σ divisors(24) = 2+3+4+6+8+12 = 35. This makes 24 a great candidate for this game (although 12, 36, and 48 might be reasonable alternatives). More details on abundant numbers can be found on mathworld.


© Jeff Offutt, 2005, all rights reserved. Copying, distribution or other use of this program without express permission of the author is forbidden. You may create links to pages in this web site, but may not copy all or part of the text without permission of the author.