The code for this game is available on GitHub. The drag and drop functionality uses interact.js. If you are on mobile, you might prefer to play the game by itself here. If you have feedback, leave a comment!

The Rules

In this game, you start with a set of initial digits and a goal number. Your task is to combine the initial digits using different mathematical operations to reach the goal number.

You might have heard of or played this kind of game before (I've listed some variations below). In this version, all the basic operations are permitted, which includes (+, -, *, /) as well as exponents (ab). The key differentiator is the inclusion of concatenation, and an inverse that we'll call 'digit splitting'.

What do I mean by 'digit splitting'? This means the original digits or any digits that are part of intermediate results can be split apart, rearranged, and recombined into new numbers in any way. For example, given the number 23, you can use the digits 2 and 3 individually, combine them with +/-/etc, or rearrange them to make 32.

This gives you a lot of options. Starting just with the numbers 2 and 6, you can make:

$$\begin{align}
2+6 & =8 \\
6-2 & =4 \\
2\times 6 & =12 \\
6/2 & =3 \\
6^2 & =36 \\
2^6 & =64 \\
2||6 & = 26 \\
6||2 & = 62 \\
\end{align}$$

From here, you can take the digits from these results and make new numbers. For example, you could take 64 and split this into a 6 and a 4 to make 24, 46, 46, and more.

To show solutions to particular puzzles, I'll use a set notation with arrows. For example, suppose our initial digits are 7 and 8, and the goal is 65. One solution is:

$$\{7,8\} \xrightarrow{\times} \{56\} \xrightarrow{split} \{5,6\} \xrightarrow{\Vert} \{65\}$$

Background

This is a mental math game I've been playing for many years[1] but the original inspiration may have come from a worksheet I did sometime in middle school called the the Four Fours puzzle. The idea is to combine four 4s using basic math operators to make different numbers. If you try this out, you'll see you can make all the numbers from 1 through 9 using only the four basic operators (+, - *, /) and parentheses.

$$\begin{align} (4/4)\times (4/4) & =1 \\\\ (4/4) + (4/4) & =2 \\\\ (4\times 4 -4)/4 & =3 \\\\ (4-4)\times 4 +4 & =4 \\\\ (4\times 4 + 4)/4 & =5 \\\\ (4+4)/4+4 & =6 \\\\ 4+4-(4/4) & = 7 \\\\ 4+4-4+4 & = 8 \\\\ 4+4+(4/4) & = 9 \\\\ \end{align}$$

However, using only these operators you'll get stuck at 10. We can get to 10 by introducing something new, like concatenation: $$(44-4)/4=10$$

This doesn't get you far - now you'll be stuck at 11. To continue, you can introduce square roots, factorials, logs, etc, and if you bend the rules in this way enough, you can actually generate any number with four 4s[2].

I don't love this solution. Functions like square roots or logs operate on just one number, instead of two numbers like our original operators. For this reason, I'd prefer to add exponentiation (ab) to the toolkit. This plus the digit splitting operation (which acts as a kind of 'inverse' to concatenation) resulted in the game.

So, in this game can we get to 11 starting with four 4s? Here is one possible solution:

$$\{4,4,4,4\} \xrightarrow{\times} \{4, 4, 16\} \xrightarrow{\times} \{4, 64\} \xrightarrow{split} \{44,6\} \xrightarrow{-} \{38\} \xrightarrow{split} \{3, 8\} \xrightarrow{+} \{11\}$$

Variations

I haven't found a reference to someone playing this game with these exact rules before, but there are many similar variations.

One is the 24 game. In each round, a playing card with four numbers is dealt face up, and a group of players tries to figure out how to reach 24 using the four numbers on the card and basic math operations. The first person to do so gets a point.

Maths24card

This is a good example (image from here). Create 24 using 2, 9, 6, 6, and basic math operations.

$$(9\times 6 - 6)/ 2 =24$$

Another is the British game show 'Countdown'. In one portion of the game, players are given 6 starting numbers (usually including a few small numbers, and few large round numbers like 25, 50, or 100) and a goal number between 0 and 1000. Here's a video of a particularly tricky case:

In this video the goal is to create 952 using 100, 75, 25, 50, 6, and 3.

$$((100 + 6) \times 3 \times 75 - 50) / 25 =952$$

There are weirder variations. One mathematician decided to find ways to generate numbers using each of the digits from 1 through 9, with the added requirement that the digits must appear in increasing or decreasing order reading from left to right. For example:

$$\begin{align}
60&=1+2\times 3\times 4 + 5 + 6 + 7+ 8+ 9\\
60&= 9+ 8+7+6 +5\times 4 + 3^2 + 1
\end{align}$$

This paper contains solutions for every integer up to 11,111 - with one exception[3].

A proof of completeness

It turns out that in this game there are only a few types of starting sets where you'll be 'stuck', and unable to create any possible number given enough steps. This might make sense intuitively: as long as we have 2 digits of a reasonable size, we can use the exponent operator to create a large number with lots of digits to work with, and if necessary keep repeating the process. Let's call starting sets of digits where you can create any possible number complete sets.

The first step in the proof is noticing a key pattern. Play with this game for a bit and you'll notice certain numbers and operations can create 'loops':
$$\{25\} \xrightarrow{split} \{2, 5\} \xrightarrow{a^b} \{25\} \\
\{3,7\} \xrightarrow{a^b} \{343\} \xrightarrow{split} \{3,4,3\} \xrightarrow{+} \{3,7\}
$$

Here's another example that's not quite a loop:
$$\{3,6\} \xrightarrow{a^b} \{216\} \xrightarrow{split} \{2,1,6\} \xrightarrow{a^b} \{1, 36\} \xrightarrow{split} \{1, 3, 6\}$$

Notice we returned to our original set but with an additional '1' digit. By repeating this process, we can continue to generate more 1s, and thus create any number. Therefore, with our terminology, any starting set containing the digits 3 and 6 is a complete set. In addition, any starting set that can be used to reach a set with a 3 and a 6 is also a complete set.

So, when are we able to reach a set with a 3 and a 6? First let's consider all starting sets with 2 digits (1 digit starting sets are always stuck where they started). There are 100 of these. It's not too difficult to check by hand that all except for a few can reach a set with a 6 and a 3 and are therefore complete. For example:

$$\begin{align}
\{2,6\} &\rightarrow \{36\} \\
\{2,7\} &\rightarrow \{49\} \rightarrow \{4,9\} \rightarrow \{36\} \\
\{2,8\} &\rightarrow \{256\} \rightarrow \{2,5,6\}\rightarrow \{3,6\} \\
\{2,9\} &\rightarrow \{512\} \rightarrow \{5,1,2\}\rightarrow \{6,2\} \rightarrow \{36\}\\
\ldots
\end{align}$$

The exceptions are:

$$\{0, x\}, \{1, x\}, \text{where } x \in \{0, 1, 2, \ldots 8, 9\} \\
\{2, 2\}, \{2, 3\}, \{2, 4\}, \{2, 5\}$$

You should be able to convince yourself that the only starting sets with 3 digits that might not be complete must contain two numbers from one of the above sets and one additional number. Try adding an additional digit to one of the above sets and you'll see almost all become complete. For example, by adding a 0 to the set {1, 2}, it becomes complete:

$$\{1,2,0\} \rightarrow \{2,10\} \rightarrow \{1024\} \rightarrow \{10,2,4\} \rightarrow \{10, 16\} \rightarrow \{26\} \rightarrow \{2, 6\} \rightarrow \{36\}$$

The only sets of 3 digits that are still not complete are:

$$\{0, 0, x\}, \{0, 1, 1\}, \{1, 1, 1\}$$

By the same logic, the only sets of 4 or more digits that are not complete are:

$$\{0, 0, 0, \ldots, x\}$$

That covers it -- every initial starting set other than those listed above is complete and can be used to reach any goal number.


  1. We grew up in a house on a dirt road with a long, gravel driveway. Before I had my license, my dad would drive my brother and I to the end of the driveway where we'd wait for the bus to come. This saved us a few minutes of sleep and helped us stay warm in the winter. I remember practicing this game with the numbers on the dashboard clock while we waited. The only unfortunate thing about this was seeing the same times over and over every morning (about 6:30 to 6:50). ↩︎

  2. This video shows how you can make any number using four 4's. The punch line is a stack of square roots, where each additional square root added to the stack increments the result by one. It's clever but a little unsatisfying. ↩︎

  3. The one number that can't be created is 10958 with digits in increasing order. This video from numberphile goes into more detail about the problem (there's even a sequel with a sort of solution). ↩︎