# The 24 Game and Kin

We are looking at various mathematical puzzles and games, with a focus on discussing rules and strategies, and then letting you play. Last time we discussed Four Fours, in which we are given a fixed set of “inputs” to a calculation (usually 4, 4, 4, 4), and want to find expressions that yield as many particular “outputs” as possible (e.g. everything from 1 to 100). This time, we will look at the 24 Game, which is sort of the reverse: The “output” is fixed (usually 24), and want to find expressions using various sets of “inputs” that yield that result (e.g. 3, 3, 8, 8). The rules are more strict, so strategies are a little different.

## 5, 6, 7, 7: Working backward

We received dozens, if not hundreds of questions about this game over the years; it happens that the only ones put in the archive for public view are the very hardest cases. So half of this post will be unarchived questions and answers that better introduce the puzzle, then work toward the hard ones.

This is from 2006:

How do I work a math problem in reverse?

I need to end up with an answer of 24. I am able to use the numbers 5, 6, 7, and 7 only once and am able to use addition, subtraction, multiplication or division without restriction.

There are so many ways to configure those 4 numbers, the possibilities seem endless. I figure there has to be some logic to figure this out - I just don't know what it is!

Example: 7*7 = 49*5 = 245/6 = 40.8 (we have tried this with all numbers).
Example: 7+7 = 14*6 = 84/5 = 16.8 (again, we have tried this with all numbers).

Holly is right; there are very many ways to arrange the numbers and operations! We’ll later look at what it takes to try all possibilities; what we need is a way to more quickly find a solution, trusting that there is one. (The published game has a set of cards with groups of four numbers, graded by difficulty; if you were to choose four numbers at random, it might well be impossible.)

Holly’s attempts, written as expressions, are $$(7\times 7)\times 5\div 6 \approx 40.8 \ne 24$$ and $$(7 + 7)\times 6\div 5 = 16.8 \ne 24$$.

We get lots of questions about the 24 game. There's no one quick way to solve them all; the only way I know to be sure to solve one is to try every possibility in an orderly way, and you know how hard that is.

A "heuristic" method (using insight to try to find an answer quicker than that) will not be foolproof, but often helps. What I usually do is essentially an orderly search, but done in a way that hopefully will start with some of the more likely possibilities.

I offered one heuristic, for our example of 5, 6, 7, 7:

I often start by thinking about the LAST operation being done. Suppose that is a multiplication. The easy cases would be when I multiply a whole number by one of the given numbers and get 24. In this example, the only possibility is 6 times 4; so I would ask myself whether I can get 4 from 5, 7, and 7. That reduces the problem to one with only three numbers, so it's easier to see possibilities. I don't see a way; so I might either consider the possibility that we have to multiply a FRACTION by one of the numbers, or that we will be multiplying together two numbers that are each obtained by combining two of the given numbers. Both of those are harder to work with.

The first possibility I considered had the form $$(\text{something equal to 4})\times 6;$$ the harder ones are, for example, $$(\text{something equal to 24/5})\times 5,$$ and $$(\text{something equal to 3})\times(\text{something equal to 8}).$$ The latter are worth considering, but generally left for last.

So before I try the hard cases, I usually look for ways in which the last operation might be addition or subtraction. That is, if the last step is adding or subtracting 5, I need to be able to get 24+5=29, or 24-5=19, from the remaining numbers, 6, 7, 7. I don't see a way to do that, so I try 6, and so on.

Having said all that, I can't find a solution yet! Keep trying, and I'll try again later, too.

Here I have tried possibilities like $$(\text{something equal to 29}) – 5$$ or $$(\text{something equal to 19}) + 5$$.

Twenty minutes later, I added this:

As soon as I left the computer I wrote down your numbers, looked at them, and almost immediately realized I'd missed the answer on the very first guess I mentioned.

It turns out that you CAN make 4 from 5, 7, and 7. Can you see how?

Do you see it yet? I must have just been too focused on explaining my thinking, rather than actually thinking!

The next day, Holly wrote,

Just curious to see if what I came up with was the same thing that you did:

5 - (7/7) * 6 = 24

Thanks so much for your help.

She had the right idea, but the wrong notation, perhaps not being familiar with the order of operations. I answered,

That's what I got, but you have to place the parentheses differently to get the correct result:

(5 - 7/7) * 6

This way it says to first divide 7 by 7, then subtract that from 5, and then multiply by 6. Your version would give -1, since you would have to divide 7 by 7, multiply that by 6, and then subtract.

But you got the right answer.

So we both found that $$\displaystyle 5 – \frac{7}{7} = 4$$, so we just had to multiply that by 6. In elementary-level form, this is $$(5 – 7 \div 7) \times 6 = 24$$

## 9, 2, 8, 7: Pairing up

This one is from 2002:

Figure the total of 24

How can you make the numbers 9, 2, 8, & 7 equal 24 by adding, subtracting, multiplying and/or dividing the numbers?

Doctor Schwa responded as we prefer to do on these, with a quick hint, suggesting a possible last operation:

Hi Sharon,
Here's a hint: make 32 - 8.

That was enough; Sharon responded,

I figured out the answer to the question i asked you and we both have the same answer but you did not explain how you got it.

The children in my son's class are in a contest called 24 and the child that gets the most correct in a certain amount of time will win From the school a $50.00 savings bond. It will then be held Countywide and the winner will win a$1000 saving bond.
My son came in 2nd place.  (boo-hoo)

Anyway the answer to my question was: 7 + 9 = 16 x 2 = 32 - 8 = 24

Have you ever heard of this thing called "24"?

This answer, as a single expression rather than a chain of calculations, is $$(7+9)\times 2 – 8 = 24$$

Now it was time to teach a strategy, which is just a little different from mine:

Yes, this 24 game is a lot of fun!

Teachers around here use it, or variants of it, as a way to practice number sense and order of operations.  Usually they use it as a start-of-class activity to get people warmed up and thinking mathematically.

My method of solving these is to group the numbers into pairs, or into sets of three and one, and then to try to figure out if there's anything I can make in the groups that I could then combine to make 24.

It took a while to see that (2,7,9) and (8) could become 32 - 8, but eventually I noticed that.  At first I was trying to make 3*8 or 16 + 8, neither of which worked out.

I think one of the hardest problems of this type is 3,3,7,7.  5,5,5,1 is similar and perhaps just a tiny bit simpler.

We’ll be closing with those last two examples, once we’ve built up to them.

## 2.8, 2, 1, .2: Decimals first

The typical problem uses only whole numbers, and often only single-digit numbers. But the game can be extended to provide practice with decimals or fractions.

Here is a very different one from 2001:

Finding 24

Have to get 24 by using these numbers once:

2.8   2   1   .2

using addition, subtraction, multiplication or division. Don't know where to start.

Interesting variant on the traditional 24 game!

Here's a hint: We have to get rid of the decimal parts of 2.8 and .2. I can think of two ways of doing that, either add them:

2.8 + .2 = 3

or divide by .2:

2.8 / .2 = 14

(Note that dividing by .2 is the equivalent of multiplying by 5.)

This fits a general strategy that is also useful in algebra: Find the “worst” thing about what we are given, and fix that first. Here, it’s the decimals. No other addition would accomplish this, but we could divide anything (including the result of some operation on the other numbers) by 0.2.

You may want to try doing some operations with the 2.8 before dividing by .2, for example:

(2.8 - 1) / .2 = 9

and so on.

Can you find the answer now? Here’s one more hint: Nothing he wrote is part of the actual answer, but the last one came close. You can use my previous strategy in combination with his ideas.

## -5, -2, 6, 8 = 20: Ones, zeros, and negatives

The next one, from 2008, involves several modifications: We have negative integers, and a different target (20 instead of 24); also it appears that the allowed operations are extended, though we won’t need that.

Solve -5, -2, 6, 8 = 20

Using the rule of Go 20 and given the above numbers they must equal 20. I have tried many combinations like the one below: (6+8) + (-5-2) = I have tried BEDMAS, exponents, etc

Doctor Ali answered, mostly giving general strategies:

Hi Philip!

Let's talk first about how we can deal with this kind of problem.

There are a finite number of operators, and a finite number of places to put them, so this creates a finite number of possible solutions.

In theory, we could try them all, but the number of possibilities may be so great that we'd be unable to do this by hand.  (A computer can help with this.)

However, sometimes we can be clever, which lets us rule out lots of possibilities so we never even need to consider them.

He is going to suggest more heuristic methods.

(Note that sometimes a problem like this may have no solution.  An example would be to add basic operators to

1 ? 1 ? 1 = 10

But there's no way to do it.  So we always have to be aware of this possibility.)

If we were allowed to concatenate and use decimals, as in Four Fours, this one could be done; but that wouldn’t just be inserting operations. We have received a number of 24 games over the years that a computer reports as impossible; for example, try 3, 5, 7, 7, or 8, 9, 9, 9. Rather, don’t!

Let me give you some examples of using cleverness to narrow the set of possibilities that need to be considered.  This isn't a set of steps you can follow to just take you to the answer.  (If there were such a set of steps, no one would bother to pose problems like this.  The purpose of such problems is to give you practice at being organized in your searches... and to give you lots of practice with arithmetic!)

If you're given small values, and you need to get a large result, consider using multiplication (or exponents, or factorials if they're allowed by the problem), and of course, addition.

If you're given large numbers, and you need to get a small result, consider using division, or roots if allowed.  Also, of course, subtraction.

These are valuable general rules that I follow in many puzzles, such as sequences.

Maybe the most useful thing I know is that, if you can get the result with SOME of the numbers, you can try to convert the others into ones and zeros, since

result + 0 = result

and

result * 1 = result

So by getting ones and zeros, you can get some of the numbers to just 'disappear' from the problem!  Here's an example:

Use 3, 8, 2, and 1 to get 24.

Since 3*8 is 24, we'd like the 2 and 1 to just go away.  Since (2-1) is zero, we can do this:

24 = 3 * 8 * (2 - 1)

The hardest problems won’t allow for this, but if you want to solve an easy one quickly, be sure not to miss these possibilities! They are very useful in the Four Fours game.

Also, note that when all else fails, for small problems you CAN do a systematic search of every possibility!  The hard part about that is making sure that you don't skip some possibilities, or waste your time considering others more than once.  See

Combining Numbers
http://mathforum.org/library/drmath/view/64637.html

The final tip I have for you is this.  When I look at the problem

Use -5, -2, 6, and 8 to get 20.

I start looking for partial solutions.  For example,

20 = -5 * -4    So if I can use -2, 6, and 8 to
make -4, that will work.

20 = -2 * 10    So if I can use -5, 6, and 8 to
make 10, that will work.

20 = -5 + 25    So if I can use -2, 6, and 8 to
make 25, that will work.

20 = -5 - -25   So if I can use -2, 6, and 8 to
make -25, that will work.

and so on.  In fact, I can tell you right now that one of the four tips above will lead you to a solution...

Have you solved it yet?

## 3, 3, 8, 8: The long way

Now let’s look at one of the hardest problems, and solve it the hardest way! This is the answer Doctor Ali referred to above, from 2002:

Combining Numbers

Combine the numbers 3, 3, 8, and 8, using only addition, subtraction, multiplication, and division, to come up with the number 24.

We appear to have used every combination and have not come up with the answer 24.  We just need to know how it is worked out please.

Warm regards,
Roger

This one where my usual advice is that the very last thing you’d think of is the answer!

Hi Roger,

What makes this kind of problem so difficult is that it's easy to just start trying things, without any good way of keeping track of what you've tried, or any way of knowing when you've tried everything.

Ultimately, all the operators (+, -, *, /) are binary, which means they have to work on two operands, so we have to begin by choosing two operands to work with.  There are three ways we can do that:

(3,3,8,8) -> ((3,3),8,8)
((3,8),3,8)
((8,8),3,3)

Here are the results we can get by applying one operator to these pairs of operands:

(a,b)    a+b  a-b  b-a  a*b  a/b  b/a   Remaining

(3,3) ->   6    0    0    9    1    1   (8,8)

(3,8) ->  11   -5    5   24  3/8  8/3   (3,8)

(8,8) ->  16    0    0   64    1    1   (3,3)

Those are all the possible results from the first operation you do. Note that some of them are fractions; normally you’d set those aside, but that turns out to be exactly what you shouldn’t do in this case!

Note that we can use each of the numbers in the center as a new starting point for a smaller version of the same problem:

(3,3,8,8) -> ((3,3),8,8) => (6,8,8)
(0,8,8)
(9,8,8)
(1,8,8)

((3,8),3,8) => (11,3,8)
(-5,3,8)
(5,3,8)
(24,3,8)
(3/8,3,8)
(8/3,3,8)

((8,8),3,3) => (16,3,3)
(0,3,3)
(64,3,3)
(1,3,3)

We’ve just reduced the problem to making 24 from only three numbers! What pair might the next operation work on?

Now we can do the same thing (i.e., pair the remaining operands in various ways) again:

(3,3,8,8) -> ((3,3),8,8) => (6,8,8)   -> ((6,8),8)
((8,8),6)

(0,8,8)   -> ((0,8),8)
((8,8),0)

(9,8,8)   -> ((9,8),8)
((8,8),9)

(1,8,8)   -> ((1,8),8)
((8,8),1)

((3,8),3,8) => (11,3,8)  -> ((11,3),8)
((11,8),3)
((3,8),11)

(-5,3,8)  -> ((-5,3),8)
((-5,8),3)
((3,8),-5)

(5,3,8)   -> ((5,3),8)
((5,8),3)
((3,8),5)

(24,3,8)  -> ((24,3),8)
((24,8),3)
((3,8),24)

(3/8,3,8) -> ((3/8,3),8)
((3/8,8),3)
((3,8),3/8)

(8/3,3,8) -> ((8/3,3),8)
((8/3,8),3)
((3,8),8/3)

((8,8),3,3) => (16,3,3)  -> ((16,3),3)
((3,3),16)

(0,3,3)   -> ((0,3),3)
((3,3),0)

(64,3,3)  -> ((64,3),3)
((3,3),64)

(1,3,3)   -> ((1,3),3)
((3,3),1)

Now we have to apply each possible operation to the inner parentheses in each of the 34 groups of numbers. There are 22 distinct pairs to operate on:

For the next step, we need to make up another table for the distinct pairs in the rightmost column:

(a,b)      a+b   a-b   b-a   a*b   a/b   b/a     Remaining

(-5,3) ->   -2    -8     8   -15  -5/3  -3/5     8
(-5,8) ->   -3   -13    13   -40  -5/8  -8/5     3
(0,3) ->    3    -3     3     0     0    ~      3
(0,8) ->    8    -8     8     0     0    ~      8
(3/8,3) -> 27/8 -21/8  21/8   9/8  3/24     8     8
(3/8,8) -> 67/8 -61/8  61/8     3  3/64  64/3     3
(1,3) ->    4    -2     2     3   1/3     3     3
(1,8) ->    9    -7     7     8   1/8     8     8
(8/3,3) -> 17/3  -1/3   1/3     8   8/9   9/8     8
(8/3,8) -> 32/3 -16/3  16/3  64/3  8/24     3     3
(3,3) ->    6     0     0     9     1     1     0, 1, 16, 64
(3,8) ->   11    -5     5    24   3/8   8/3     -5, 3/8, 8/3,
5, 11, 24
(5,3) ->    8     2    -2    15   5/3   3/5     8
(5,8) ->   13    -3     3    40   5/8   8/5     3
(6,8) ->   14    -2     2    48   6/8   8/6     8
(8,8) ->   16     0     0    64     1     1     0, 1, 6, 9
(9,8) ->   17     1    -1    72   9/8   9/8     8
(11,3) ->   14     8    -8    33  11/3  3/11     8
(11,8) ->   19     3    -3    88  11/8  8/11     3
(16,3) ->   19    13   -13    48  16/3  3/16     3
(24,3) ->   27    21   -21    72     8   1/8     8
(24,8) ->   32    16   -16   192     3   1/3     3
(64,3) ->   67    61   -61   192  64/3  3/64     3

Now that we are near the goal, we can start writing down less and thinking more:

Okay, so what can we do with this?  Well, the _only_ way we can end up with 24 is if we can do it in one by adding, subtracting, multiplying, or dividing something from the Remaining column in a given row with something else in the row.

For example, let's look at the row

(a,b)      a+b   a-b   b-a   a*b   a/b   b/a     Remaining

(-5,3) ->   -2    -8     8   -15  -5/3  -3/5     8

There is no way to combine 8 with -2, -8, 8, -15, -5/3, or -3/5 to end up with 24.  So we can forget about this row.

A quick scan handled that row.

Let's cherry-pick the easy ones:

(a,b)      a+b   a-b   b-a   a*b   a/b   b/a     Remaining

(-5,3) ->   -2    -8     8   -15  -5/3  -3/5     8 (No)
(-5,8) ->   -3   -13    13   -40  -5/8  -8/5     3 (No)
(0,3) ->    3    -3     3     0     0    ~      3 (No)
(0,8) ->    8    -8     8     0     0    ~      8 (No)
(3/8,3) -> 27/8 -21/8  21/8   9/8  3/24     8     8 (No)
(3/8,8) -> 67/8 -61/8  61/8     3  3/64  64/3     3 (No)
(1,3) ->    4    -2     2     3   1/3     3     3 (No)
(1,8) ->    9    -7     7     8   1/8     8     8 (No)
(8/3,3) -> 17/3  -1/3   1/3     8   8/9   9/8     8 Yes!

We have a winner: 8 divided by 1/3 is 24.  Now, how did we get here?  Tracing back, we find that the corresponding expression is

8        8
------- = ----- = 8*3 = 24
3 - 8/3    1/3

This, I often say, is the last thing you’d try, because it involves a fraction as an intermediate value, which our minds want to avoid. But it’s perfectly legal!

So, this wasn't pretty, but I knew that I was covering all the bases, and that I wasn't touching any of them more than once.  It's nice when you can 'see' the answer directly, which sometimes happens; but when that doesn't work, it's good to have a backup plan.

In a much later comment, Doctor Ian said, after giving a link to this answer in response to an even harder problem, “Sorry I can’t be of more help, but as you can see, I’ve already been through this kind of thing once, and that’s more than enough for one lifetime.”

## 3, 3, 7, 7: Hints for a hard one

We usually just give hints to help a student discover these hard ones. Here is a question from 2002:

Make 7,7,3,3 into 24 Using + - * and /

Make the numbers 7,7,3,3 equal 24 using the operations addition, subtraction, multiplication, and division.

Two of us answered. I got in first, with a very brief hint:

Hi, Jeremy.

This is a tricky one, because the answer involves fractions. Think about the fraction 24/7.

Sometimes I merely say, “Don’t be afraid of fractions!” The number 24 is used for the game because it has many factors, so we have many whole numbers we can multiply by; but it isn’t wrong to multiply by a fraction!

This is a really hard one!

As a hint, here's how it works with 5,5,5,1:

5 * (5 - 1/5) = 24.

Can  you see a similar pattern that might work with your four numbers?

Neither of us gave the answer to the given problem, so I’ll leave that for you to figure out! But notice how this one works, and how it fits with my clue. In working backward, you normally look for factors of 24 that you can multiply by a number derived from the others. Here we have none (except 1, which doesn’t help); but we can still get 24 by multiplying $$\displaystyle 5\times\frac{24}{5}$$. And we can get that fraction, which is equal to $$\displaystyle 4\frac{4}{5}$$, by subtraction.

When all else fails, look for fractions.

Another hint for similar cases is given here:

Make 24

I’ll close with a list of problems we got over the years, which vary considerably in difficulty.

### Relatively straightforward

1, 2, 2, 6
1, 2, 5, 6
1, 4, 4, 6
2, 2, 6, 9
2, 3, 3, 6
2, 3, 5, 9
3, 4, 6, 8
5, 7, 8, 8
3, 3, 3, 5
1, 4, 6, 7
2, 2, 3, 5
2, 7, 8, 9
2, 5, 5, 8
3, 3, 5, 7
3, 3, 6, 8
2, 6, 6, 9

### A little harder

1, 4, 6, 10
4, 9, 10, 16
22, 20, 11, 9
1, 1, 2, 9
7, 7, 4, 1
7, 7, 4, 4
4, 5, 5, 7
1, 4, 5, 6
1, 3, 4, 6
1, 6, 6, 8
5/8, 1/4, 2/3, 7
3, 3, 6, 3/4
-7, -7, -4, 1

### Different targets

8, 9, 4, 12 = 12
2, 5, 7, 9 = 11, no solution?
2, 3, 4, 5 = 28
2, 3, 4, 5 = 26
2, 3, 4, 5 = 80
5, 5, 13, 13 = 70

I haven’t bothered to check this last group; the rest were checked with an online “24 game solver”.

This site uses Akismet to reduce spam. Learn how your comment data is processed.