# Arithmetic Puzzles - Operator Search

**Operator Search** is a type of arithmetic puzzle in which you need to find proper mathematical operators in a given equation such that the equation holds true. In the following example, if we consider the 4 mathematical operators \((+ , - , \times , \div)\), then there are \(4^3=64\) possible combinations:

\(\hspace{5cm} 1\, \square \, 2\, \square\, 3\, \square\, 4\ = 10.\)

Are we supposed to list out all 64 possible combinations in order to solve it? Not necessarily! There are certainly ways to reduce the number of cases to check. However, you should keep in mind that there may not necessarily be a unique solution, and some puzzles might even have no solution!

In this wiki, we will only be using the 4 mathematical operators \((+, - , \times , \div)\), and BODMAS order of operations is applied unless otherwise stated. By the end, you should be able to identify a couple of tricks that can help you solve these problems with ease.

Operator search puzzles are similar to their sister page, Fill in the Blanks, because the former is to fill in the operators given the numbers whereas the latter is to fill in numbers given the mathematical operators.

#### Contents

## Explanation of Rules

### 1. Each \( \square \) can only be replaced with a mathematical operator.\[\]

For example, \(a \, \square \, b = \begin{cases} { a + b \ \text{ or} } \\ {a- b \ \text{ or} } \\ {a\times b \ \text{ or} } \\ {a \div b.} \end{cases} \) \[\]

### 2. A mathematical operation has to be done for each \( \square .\)\[\]

In particular, there is no combining of digits. For example, \(1 \, \square \, 2 = 12 \) is not allowed. \[\]

### 3. Numbers are fixed in the given order.\[\]

Keep in mind that we cannot rearrange the digits, i.e. \(8 \ \square \ 4 \ne 4 \ \square \ 8 \). This is because each square represents a mathematical operator on the presumption that the positions of the numbers are fixed.

For another explicit example, \( A \, \square \, B \, \square \, C \) is not the same as any of the following:

\[ \begin{array} &A \, \square \, C \, \square \, B, &B \, \square \, A \, \square \, C, &B \, \square \, C \, \square \, A, &C \, \square \, B \, \square \, A, &C \, \square \, A \, \square \, B. \end{array} \] \[\]

### 4. Obey the order of operations.\[\]

As usual, following the conventions of BODMAS, we should always solve for parenthesis, multiplication, and division first. For example, for the following expression:

\[ \large 2 \ \square \ 2 \ \square \ 2 \ \square \ (2 \ \square \ 2 \ \square \ 2), \]

if the five squares (left to right) represent \( + \times \times \div - ,\) then

\[ \begin{eqnarray} 2 \ \square \ 2 \ \square \ 2 \ \square \ (2 \ \square \ 2 \ \square \ 2) &=& 2 + 2\times2\times(2\div2-2) \\ &=& 2 + 4 \times (1-2) \\ &=& 2 + 4 \times (-1) \\ &=& 2 + (-4) \\ &=& -2. \end{eqnarray} \]

Here is an easy example as a start:

\[ \large 3 \ \square \ 3 \ \square \ 3 \ \square \ 3\ \square \ 3 \]

## Determine the value of the expression above, where the 4 squares (left to right) represent the following operators: \[\]

\(\begin{array}{r r l} & \text{i)} & + - \times \div\\

& \text{ii)} & - \times \div + \\

& \text{iii)} & \times \div + -\\

& \text{iv)} & \div + - \times \end{array}\)

By obeying the order of operations, we obtain the answers of \(3, 3, 3, -5\) for \(\text{i), ii), iii), iv),}\) respectively. \(_\square\)

## Trial and Error

How would we solve operator search problems? If we didn't know any better, we would just start off by throwing in random sequences of operators. Albeit not the most effective way, the trial and error approach allows us to obtain all possible results by working through all of the possible cases and determine the solutions that satisfy the given criteria.

Note that because each square is restricted to only four operators, by the rule of product the number of possible cases of \(N\) squares is \(\displaystyle 4^N \). As such, as there are more squares, this process becomes much more tedious.

\[\large 2 \ \square \ 3 \ \square \ 6 = 1 \]

## Determine all pairs of mathematical operators such that the above arithmetic puzzle is true.

Listing out all \(4^2 = 16\) possible combinations, we have

\[\begin{array} {c | c | c | c | c } & + & - & \times & \div \\ \hline + & 2 + 3 + 6 = 11 & 2 + 3 - 6 = -1 & 2 + 3 \times 6 = 20 & 2 + 3 \div 6 = \frac{5}2 \\ \hline - &2 - 3 + 6 = 5 & 2 - 3 - 6 = -7 & 2 - 3 \times 6 = -16 & 2 - 3 \div 6 = \frac{3}2 \\ \hline \times & 2 \times 3 + 6 = 12 & 2 \times 3 - 6 = 0 & 2 \times 3 \times 6= 36 & \color{blue}{2 \times 3 \div 6 = 1} \\ \hline \div & 2 \div3 + 6 = \frac{20}3 & 2 \div3 - 6 = -\frac{16}3 & 2 \div3 \times 6 = 4 & 2 \div3 \div6 = \frac19 \\ \end{array} \]

By listing out all the possible combinations, we can conclude that there is only one solution, namely \(2 \times3\div6 = 1 \). Thus the two mathematical operators (left to right) that satisfy the given equation are \(\times \) and \(\div .\) \(_\square\)

We should keep in mind that even after we have discovered one solution that fits, we would still have to continue searching for other possible solutions. This is because not all problems would have a unique solution.

\[ \large 3 \ \square \ 5 \ \square \ 6 \]

## Determine all pairs of mathematical operators such that the above arithmetic puzzle yields an integer.

Listing out the all \(4^2 = 16\) possible combinations, we have

\[\begin{array} { c | c | c | c | c } & + & - & \times & \div \\ \hline + & \color{green}{3 + 5 + 6 = 14} & \color{green}{ 3 + 5 - 6 = 2} & \color{green}{3 + 5 \times 6 = 33} & 3+ 5 \div 6 = \frac{23}6 \\ \hline - &\color{green}{3 - 5 + 6 =4} & \color{green}{3 - 5- 6 = -8} & \color{green}{3- 5 \times 6 = -27} & 3 - 5\div 6 = \frac{13}6 \\ \hline \times & \color{green}{3 \times 5 + 6 = 21} & \color{green}{3 \times 5 - 6 = 9} & \color{green}{3 \times 5 \times 6= 90} & 3 \times 5 \div 6 = \frac{5}{2} \\ \hline \div & 3 \div5 + 6 = \frac{33}5 & 3 \div5- 6 = -\frac{27}5 & 3 \div5 \times 6 = \frac{18}5& 3 \div5 \div6 = \frac1{10} \\ \end{array} \]

By listing out all the possible combinations, we can conclude that there are 9 solutions such that the arithmetic puzzle yields an integer solution. \(_\square\)

For this example, is it really necessary to work through all 16 cases? It seems tedious, isn't it? Well yes, there is a nifty little trick to reduce your work.

Notice that \( 3\div 5 \) is not an integer, so \(3\div 5 \ \square \ 6 \) can never be an integer. This is because \(6\) is not a multiple of the denominator \(5\). Similarly, \(5\div6 \) is not an integer, so \(3\ \square \ 5 \div 6 \) can never be an integer. This is because \(3\) is not a multiple of the denominator \(6\). In other words, neither of the two squares in \(3 \ \square \ 5 \ \square \ 6\) can have a division sign \((\div)\) for the expression to produce an integer.

With this neat little trick, can you solve the introductory example: \( 1 \ \square \ 2 \ \square \ 3 \ \square \ 4 = 10 \)?

## What numbers can we get?

In some problems, we are not interested in finding the number of possible solutions, but need to find all possibilities for the resultant number. We would like to know what the maximum and minimum possible values are, which can help us determine if a certain number could be reached. Trial and error could get us all of the results, but if there are a lot of possibilities, then that would take a lot more work.

### 1. Largest solution

Suppose that we are interested in the maximum possible resultant number for an operator search problem. How are we supposed to find it without listing out all the possible results?

\[ \large 5 \ \square \ 6 \ \square \ 7 \ \square \ 8 \]

Take the expression above as an example. Well, a thought came to mind that we should consider adding them up: \(5+6+7+8 = 26\). However, the largest value will form from multiplying all of these numbers: \(5\times6\times7\times8 =1680\).

In general, it is always better to multiply all of the terms together. There is a slight exception to this rule when the number 1 is involved. In this case, because \( 1 + x > 1 \times x \), slight care has to be taken to consider the possibilities.

## What is the maximum possible resultant number for the following operator search puzzles?\[\]

\(\begin{array}{r r l} \\ & \text{i)} & 2\, \square \, 3\, \square \, 4 \, \square \, 5\\

& \text{ii)} & 1\, \square \, 2\, \square \, 3\, \square \, 4 \, \square \, 5 \end{array}\)

i)For the expression to be maximized, all the squares must be the multiplication sign \((\times).\) Thus the answer is \(2\times3\times4\times5=120 \).

ii)As in \(\text{i)},\) you might be tempted to have multiplication signs in all of the squares. But you can make a slight improvement on it. Because anything multiplied by 1 is itself, we can use another operator that increases the resultant number. In this case, it is the addition sign \((+)\) and thus the maximum value is\[ 1\, \square \, 2\, \square \, 3\, \square \, 4 \, \square \, 5 = 1+2\times3\times4 \times5 = 121. \ _\square\]

### 2. Positive and Negative values

In the previous example of \(3 \ \square \ 5 \ \square \ 6 \), can we determine, of all the \(4^2=16\) possible values, the number of negative values without listing them out?

Well, yes! Notice that the operations of \(+,\times,\div\) will not change the sign of the resultant number. Thus, if neither of the two squares is a negative sign, then the resultant number will have to be positive. In other words, for the resultant number to be negative, at least one of the two squares must be a subtraction sign.

Since this is only a necessary condition, we still have to check all of the scenarios just in case some of them yield positive values.

\[\begin{eqnarray} 3 - 5 - 6 &=& -8 < 0 \qquad \qquad \qquad (1)\\ \\ 3 - 5 \ \square \ 6 &: & \begin{cases}{3 - 5 + 6 = 4} \\ {3 - 5 \times 6 = -27<0 \qquad (2)}\\ {3 - 5 \div6 = \frac{13}6 } \end{cases} \\ \\ 3 \ \square \ 5 - 6 &: & \begin{cases}{3+5-6=2 } \\ {3\times5-6=9}\\ {3\div5-6=-\frac{27}5 < 0. \qquad (3)} \end{cases} \\ \end{eqnarray} \]

So there are 3 solutions for which \(3 \ \square \ 5 \ \square \ 6 \) yields a negative number. See how much quicker that went? We don't need to go through all 16 cases anymore! Now, apply what you have learnt to the following problem:

\[ \large 1 \, \square \, 3 \, \square \, 5 \]

If I were to randomly fill the squares with two (not necessarily distinct) mathematical operators out of \(( +, -, \times, \div)\), is the resultant number more likely to be positive or negative?

**Note**:

You are not allowed to use parenthesis.

Obey the order of operations.

### 3. Smallest solution

Like the largest solution discussed above, suppose that we are interested in the minimum possible resultant number for an operator search problem. How are we supposed to find it without listing out all the possible results? The smallest solution might be a little bit trickier. Let us think about the same problem as above.

\[ \large 5 \ \square \ 6 \ \square \ 7 \ \square \ 8 \]

Should we consider all subtraction signs: \( 5- 6-7-8 = -16?\) How about all division signs: \(5 \div 6 \div 7 \div 8 =\frac5{336} ?\) It turns out that neither of them works. An even smaller value would be \(5-6\times7\times8 =-331\). But how do I know this without working through all \(4^3=64\) combinations? It's simple! We just need to subtract the largest possible number! Since we start with \(5\) in this example, we only need to subtract the largest possible value from it, i.e. \(6\times7\times8\). Simple, right? Like the largest solution, there might be slight exception to this rule, especially when the number 1 is involved.

For example, \(2 \, \square \ 1 \, \square \,3 \, \square \,4 \, \square \,5 \) yields a smaller value when the first two squares are subtraction signs. That is, \(2 - 1 - 3\times4\times5 < 2-1\times3\times4\times5\).

Now, the range of all these \(4^3=64\) not necessarily distinct numbers is simply the difference between the largest and smallest resultant numbers.

\[ \large 2 \ \square \ 3 \ \square \ 4 \ \square \ 5 \]

## There are \( 4^3 = 64\) ways in which we can fill the squares above with \( +, -, \times, \div\). Find the range of all these \(4^3=64\) numbers.

The largest possible value is \(2\times3\times4\times5=120 \). The minimum possible value is \(2-3\times4\times5 = -58\). Thus, the range is \(120 - (-58) = 178. \ _\square\)

### 4. Multiple solutions

If we are interested in determining all possible solutions for which an operator search equation holds true, trial and error is carried out almost every time. Consider the following equation:

\[ (1\, \square \, 2 \, \square \, 3)\, \square \, 4 = 6.\]

Working on the ones inside the parenthesis first, we have

\[\begin{array} { c | c | c | c | c } & + & - & \times & \div \\ \hline + & 1 + 2 + 3 = 6 & 1 + 2 - 3 = 0 & 1 + 2 \times 3 = 7 & 1 + 2\div 3 = \frac{5}3 \\ \hline - &1 - 2+ 3= 2 & 1 - 2 - 3 = -4 & 1 - 2 \times 3 = -5 & 1 - 2 \div 3 = \frac{1}3 \\ \hline \times & 1 \times 2 + 3 = 5 & 1 \times 2 - 3 = -1 & 1 \times 2 \times3= 6 & 1 \times 2 \div 3 = \frac23 \\ \hline \div & 1 \div2 + 3 = \frac{7}2 & 1 \div2 - 3 = -\frac{5}2 & 1 \div2 \times 3 =\frac32 & 1\div2 \div3= \frac16 \\ \end{array} \]

By trial and error, of all of these 16 numbers, only two satisfy the condition, i.e. \(1\div2\times3\times4 = 6 \) and \(1-2+3+4=6 \).

## Focusing on Addition and Subtraction only

If we were allowed to use all 4 operators, then we have to use trial and error and check most of our cases. However, if we were to restrict the operators to just addition \((+)\) and subtraction \((-),\) then there are several other tricks that we can apply to solve the problem.

### 1. Maximum and minimum value\[\]

To find the largest value, we just need all the squares to be addition signs \((+).\) Similarly, to find the smallest value, we just need all the squares to be subtraction signs \((-).\) As an explicit example, the maximum and minimum values of \(1\ \square \ 2\ \square \ 3 \ \square \ 4 \) are \(1 + 2 + 3 + 4 = 10\) and \(1 - 2- 3- 4 = -8 ,\) respectively. \[\]

### 2. Parity Argument\[\]

In this section, we will be applying parity to solve these arithmetic puzzles. If you are not familiar with that concept, please read Modular Arithmetic - Parity.

\[ \large 1 \, \square \, 2 \, \square \, 3 \, \square \, 4 = 5\]

Consider the equation above. With the restriction of only the two operators, how can we determine all the possible solutions?

Let's use an analogy, where we consider all the squares to be light switches!

Imagine turning on a lightbulb as an addition sign \((+).\)

Imagine turning off a lightbulb as a subtraction sign \((-).\)

For the left hand side of the equation, turning on all the lightbulbs, we have a total value of \(1+2+3+4=10 \), which we will call the **initial state**. Observe that if we were to change any sign, then the value of the expression will change by twice of the number. This means that the parity of the result will still be unchanged! We have found an invariant: no matter how many signs we change, the expression must still have the same parity.

## Find all the solutions to \[\]

\[ 1 \, \square \, 2 \, \square \, 3 \, \square \, 4 = 5.\]

Since \( 1 + 2 + 3 + 4 = 10 \) is even, we know that changing the signs will still leave the number even, and thus there is no way to obtain the odd number 5. Thus there is no solution. \(_\square\)

\[ \large 1 \, \square \, 2 \, \square \, 3 \, \square \, 4 \, \square \, 5 \, \square \, 6 \, \square \, 7 \, \square \, 8 = 9 \]

There are \( 2^7 =128 \) ways in which we can fill the squares with \( +, -\).

How many ways would make the equation true?

**Note**: You are not allowed to use parenthesis.

### 3. Subset sum by parity\[\]

\[\\ \large 1 \, \square \, 2 \, \square \, 3 \, \square \, 4 = 6.\]

Now, this problem is a slight variation of the earlier example problem above. As shown in the following equations, we first add all of the original numbers and then subtract only the number(s) with subtraction sign \((-)\) twice.

\[\begin{eqnarray} 1 + 2 + 3 - 4 &=& (1 + 2 + 3 + 4) - \color{green}2(4) = 10 - 8 = 2 \\ 1 + 2 - 3 + 4 &=& (1 + 2 + 3 + 4) - \color{green}2(3) = 10 - 6 = 4 \\ 1 - 2 + 3 + 4 &=& (1 + 2 + 3 + 4) - \color{green}2(2) = 10 - 4 = 6 \\ 1 - 2 - 3 + 4 &=& (1 + 2 + 3 + 4) - \color{green}2(2+3) = 10 - 10 = 0 \\ 1 - 2 + 3 -4 &=& (1 + 2 + 3 + 4) - \color{green}2(2+4) = 10 - 12 = -2 \\ 1 + 2 - 3 -4 &=& (1 + 2 + 3 + 4) - \color{green}2(3+4) = 10 - 14 = -4 \\ 1 - 2 - 3 -4 &=& (1 + 2 + 3 + 4) - \color{green}2(2+3+4) = 10 - 18 = -8. \end{eqnarray} \]

In other words, we look for twice the sum of one or more of the values \(\{2,3,4\}\) such that the difference between twice the sum and the *initial state* is really the number on the RHS of the equation, which is \(6\) in this problem.

To put it short, in this problem we look for a subset of \(\{2,3,4\}\) such that the sum of its elements equals

\[\frac12((1+2+3+4)-6) = 2.\]

Simple, right? We can solve this puzzle by using an analogy of lightbulbs!

Let's try another scenario. Using the lightbulb analogy above, we can also solve an operator search puzzle which only has powers of 2. Suppose we want to solve the following equation:

\[ \large 1 \ \square \ 2 \ \square \ 2^2 \ \square \ 2^3 \ \square \ 2^4 \ \square \ 2^5 = 15 .\]

By considering the *initial state*, we have \(1+2+2^2+2^3+2^4+2^5=63 \), and we want to find the value of \(x\) such that \(63 - 2x = 15 \). Solving it yields \(x=24, \) which means we now need to find the sum of powers of \(2\) that add up to \(24\). So we should *switch off* the corresponding lightbulbs \(2^3 \) and \(2^4\) because \(2^3+2^4=8+16=24.\) That is,

\[ 1 + 2 + 2^2 - 2^3 - 2^4 + 2^5 = 15. \]

\[ \large 1 \ \square \ 2 \ \square \ 2^2 \ \square \ 2^3 \ \square \ 2^4 \ \square \ 2^5 \ \square \ 2^6 \ \square \ 2^7 = 47 \]

## There are \(2^7 = 128\) ways in which we can fill the squares with \(+,-\). Determine the right combination of these two mathematical operators such that the equation above is fulfilled.

By using the lightbulb analogy, we first get the initial state: \[1+2+2^2+2^3+2^4+2^5 + 2^6 + 2^7 = 255, \] which is the sum of a geometric progression. Solving for \(x,\) we have \[255 - 2x = 47 \Rightarrow x = 104. \]

So we want to find the sum of distinct powers of 2 that yields 104. Subtracting the highest power of 2 from 104 yields \(104 - 2^6 = 40 \). We repeat the process to get \(40 - 2^5 = 8 \) and eventually \(104 = 2^3 + 2^5 + 2^6.\) Thus, the following equation holds true:

\[ 1 + 2 + 2^2 - 2^3 + 2^4 - 2^5 - 2^6 + 2^7 = 47. \]

Therefore, the correct combination of mathematical operators is \[\begin{array} &+ &+ &- &+ &- &- &+. \ _\square \end{array}\]

## Game of 24

The **24 Game** is a type of operator search puzzle played with a deck of cards. We encourage you to play this game with a group of friends and see if you can beat them at it.

To play, draw 4 cards from a standard deck of 52 cards. The number cards have values corresponding to the numbers, while the Jack, Queen, King and Ace have values of 11, 12, 13 and 1, respectively. The goal is to be the first person to correctly form the number 24 using basic arithmetic operations which involve all 4 numbers. To win at this game, you will need fast thinking, good mental arithmetic, and lots of practice!

In line with this page, we are restricted to the operations of addition, subtraction, multiplication and division. However, we are allowed to

- rearrange the numbers as we wish since no order has been specified, and
- use parentheses as we wish.

Play the 24 game with the following hand:

There are multiple solutions, so give this a try before looking at the answers!

\[ \begin{align} 4 + 6 + 6 + 8 & = 24\\ ( 4 - 6 \div 6 ) \times 8 & = 24 \\ - ( 4 \times 6 ) + ( 6 \times 8)& = 24 \\

-4 + 6 \times 6 - 8 & = 24 \\ ( 6 + 6) \times 8 \div 4 &= 24. \end{align} \]If you find more, please add them in!

As a challenge, play the 24 game with the following hand:

This is not easy, so spend some time thinking before looking at the solution below.

\[ 8 \div ( 3 - 8\div 3) = 8 \div \frac{1}{3} = 24 .\]

Given our successes above, is it true that any 4-card hand will always result in 24? Out of the \( { 4 + 13 - 1 \choose 4 } = 1820 \) possible four-card hands (review Stars and Bars for further details), it turns out that about 1362 \( (\approx 72 \% ) \) of them have solutions. Given a 4-card hand, the main way to prove that there is **no solution** would be to run through all of the possible combinations of numbers and operations. If you're interested, you can write a computer program to show that the following hand has no solution:

## See Also

**Cite as:**Arithmetic Puzzles - Operator Search.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/arithmetic-puzzles-operator-search/