How to use the 24 game solver
- Enter four whole numbers from 0 to 99. The classic game uses cards from 1 to 13.
- Leave the target at 24, or enter another whole number.
- Read the number of distinct solutions and the simplest one.
- Scroll the table for the full list, and download it if you want to keep it.
Formula
Pick two numbers a and b and replace them with a + b, a x b, a - b, b - a, a / b or b / a
Repeat on the three numbers, then the two, until one number is left
Keep the expression if the last number equals the target
All arithmetic uses exact fractions, so a result such as 8/3 is never rounded
Division by zero is skipped. Two answers that differ only in the order of added terms or multiplied factors are counted as one.
Hands that are easy, tricky and impossible
4, 7, 8, 8 has 3 distinct solutions, including 4 x (7 - 8 / 8) = 24. 3, 3, 8, 8 has just one, 8 / (3 - 8 / 3) = 24, which only works through a fraction. 5, 5, 5, 1 also has one, 5 x (5 - 1 / 5) = 24.
1, 1, 1, 1 cannot make 24 at all, and neither can 7, 7, 7, 7. Of the 1,820 different hands of four cards from 1 to 13, 1,362 can make 24. 1, 2, 3, 4 has 4 solutions to make 24 and 18 to make 10.
How the game is played
In the 24 game you are dealt four numbers and must combine all of them, each exactly once, with addition, subtraction, multiplication and division and any parentheses to make 24. It is a popular mental arithmetic game because some hands have only a single, surprising answer that goes through a fraction. The solver lets you check a hand, or find out whether a hand is a dead end.
Other puzzle helpers are the Kakuro and Killer Sudoku combination finder, the sudoku solver and the magic square generator. For dice games see the dice pool calculator.
Counting distinct solutions
A full search finds many expressions that are really the same, such as 4 + 8 and 8 + 4, or (a + b) + c and a + (b + c). The page writes each answer in a standard order and lists it once. Different arrangements like a x (b + c) and a x b + a x c remain separate, since they are different calculations. The simplest listed answer is the one with the fewest parentheses.
Assumptions and limits
- Each of the four numbers is used exactly once, with the operations plus, minus, times and divide only.
- Numbers are whole numbers from 0 to 99, and the target is a whole number from -1000 to 1000.
- Intermediate fractions are allowed, and division by zero is not.
- Powers, roots, concatenating digits and other tricks are not used.
Frequently asked questions
How do I solve the 24 game?
Combine two numbers at a time with +, -, x or /, and repeat. The solver tries every choice and lists the ones that end at 24.
Can every set of four cards make 24?
No. Of the 1,820 hands of four cards numbered 1 to 13, 1,362 can make 24, about 75 percent.
Why are fractions allowed in the middle?
Some hands only work that way. For 3, 3, 8, 8 the answer is 8 / (3 - 8 / 3) = 24, with 3 - 8/3 = 1/3 on the way.
Can I use a different target?
Yes. Enter any whole number from -1000 to 1000 and the solver lists the ways to reach it from the four numbers.