# The Four Fours Puzzle: To Infinity and Beyond!

Updated: Dec 30, 2020

Hi everybody! Since my last two articles have been more on the in-depth side, I thought we'd dive into something a little more accessible (but just as fun!) this week. I took last week off for Father's Day, but this article won't disappoint!

We'll be looking at a problem called the **Four Fours problem. **

If you'd ever heard the problem, it's famed for its simplicity *and *its creativity. There are so many directions you can take this one, so I'm excited to see what you think!

For this article, every time you see a bolded question, stop scrolling! See if you can play around and answer that question before you continue, and you'll gain a little more of the fun of the process!

Let's start!

**The Four Fours problem** simply asks you to take any number and try to express it in terms of four 4's. Let me show you what I mean.

At first, let's use only addition, subtraction, multiplication, and division to manipulate our fours. You're also allowed to use any parentheses you want.

Then, if we want to make 1 from four 4's, we could maybe write:

(4/4)*(4/4) = 1.

If we wanted to make 3, we could try:

(4+4+4)/4 = 3.

Or, if we wanted to make 7, this would work:

(4+4)-(4/4) = 7

**How many numbers can you try to make? How many different ways can you think to make them?**

If right now, you're wondering exactly where this article is going—bear with me! This little puzzle might have more to offer than you thought :) We'll even be talking a little bit about programming today, and we'll be looking at how to extend the problem infinitely. This article will, however, gear just a little bit below the difficulty of the last one.

**Let's narrow in on a more specific question: What positive integers under 20 can you make? **

**It turns out you can make exactly 14 of the 20! What are they? **

**Did you get them? Here they are:**

**1 = **(4/4)*(4/4)

**2 = **(4/4)+(4/4)

**3 = **(4+4+4)/4

**4 = **4 + (4-4)*4

**5 = **(4 + 4*4)/4

**6 = **4 + (4+4)/4

**7 = **(4+4)-(4/4)

**8 = **(4+4)-(4-4)

**9 = **4+4+(4/4)

**12 **= 4*(4-(4/4))

**15 = **4*4-4/4

**16 = **4*4*(4/4)** **

**17 = **4*4+4/4

**20 = **4*((4/4)+4)

I think the interesting thing here is more that you *can't* express 10, 11, 13, 14, 18, and 19 with just four fours than that you *can* express the rest. We have four fours and we have four operations, and yet, we're limited. To illustrate this point, try to answer this question:

**There are exactly 11 other positive integers we can express with addition, multiplication, subtraction, division, and four fours. What are they? Hint: The largest is 256 = 4*4*4*4. **

**Here they are: **

**24 = **(4+4*4)+4

**28 = **((4+4)*4)-4

**32 = **(4*4)+(4*4)

**36 = **((4+4)*4)+4

**48 = **(4*4-4)*4

**60 = **4*4*4-4

**64 = **(4+4)*(4+4)

**68 =** 4*4*4+4

**80 = **(4*4+4)*4

**128 = **(4*4)*(4+4)

**256 = **4*4*4*4

Wow, there really are only 25 integers we can express with four fours and the basic four operations! But, don't take my word for it. Try it out, and see if you can come up with any others. See if you can convince yourself that this is true, and even try to prove it!

__An Abstract Discussion__

In this section, I'm going to be talking about setting up the problem for the purposes of programming it. For me, it wasn't initially obvious to discover how many integers can be expressed in this way, so I actually ended up programming it out (in Python) and confirming that the answer is 25. You don't have to know how to code to understand what I'm about to say, and I think it lends some insight to the problem, but if this discussion gets too abstract for you, feel free to skip down to the next section!

The way I set the program up was just exhaustively checking all the possibilities, by setting up 6 different "classes" of orders of the operations depending on if we added/subtracted/multiplied/divided the first and the second four first, the second and the third four first, or the third and the fourth four first (a total of *3 possibilities*).

Then, we'd have three numbers and we'd get to choose whether we apply the next operation to the first two numbers (the first and second) or the second two numbers (the second and third), for a total of *2 possibilities*.

Then, we're left with two numbers and we must apply the final operation to them (*1 possibility*).

These are chosen independently, so there are 6 total possibilities.

Since addition, subtraction, multiplication, and division must be applied to *two *numbers that are *right next *to each other in the series of fours, these are all the possible combinations.

Here are the 6 classes (or orders we can apply the operations in). Here, I'm replacing each operation with #, and I'm also listing what pairs we're applying the operation to at each stage. For example, 1-2, 2-3, 1-2 means we applied the first operation to the first two fours, then the next to the second and third numbers left after we apply the first operation, and finally our final operation to the two at the end.

((4#4)#4)#4 1-2, 1-2, 1-2

(4#4)#(4#4) 1-2, 2-3, 1-2

(4#(4#4))#4 2-3, 1-2, 1-2

4#((4#4)#4) 2-3, 2-3, 1-2