top of page

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?

Courtesy of Wikipedia.

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.

Courtesy of PDFSlides.Net

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

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

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


All this is, is an analytical way of keeping track of the different possibilities for adding/subtracting/multiplying/dividing our fours! The # serves as a placeholder for our possible operations, and our reasoning helped us to confirm that we have all possible orders.


Then, we're free to ask the computer to plug in and try all the possible combinations for each #—addition, subtraction, multiplication, and division—and finally give us the numbers that are possible at the end. (Don't worry though, the conclusion we're reaching at the end of this article is not nearly as bashy as this one!)


A couple of specific notes:

Notice that the fifth and the second class ended up being the same! That's because we're essentially applying operations to the first two fours and the second two fours separately (and it doesn't matter which pair we do first) before we apply the operation in the middle!


Notice also that if we use addition or multiplication (because they're commutative, if you know that word), some of the classes will end up being equivalent. For example, plugging in addition to the first and the fourth, we get: ((4#4)#4)+4 = 4+((4#4)#4)


Notice also that many of these combinations can end up as negative numbers or fractions, and we do have to filter those out when we program this. We also have to account for any undefined combinations as we cannot divide by zero.


This helps to explain why we only ended up with 25 numbers (as a lot of the combinations can end up being the same or invalid), but it doesn't fully explain it. After all, our scheme would give a potential mound of 4*4*4*6 =384 (4 operations, applied 3 times, and 6 classes), but in the end, we only end up with 25 numbers. I think that's a testament to the difficulty of the problem—you have to be pretty creative to come up with a new number that works!


A Bit About Programming

I'll take a moment to say that coding is a really valuable skill if you'd like to pursue math. Some problems are best solved with elegant arguments, like the Six-Color and Five-Color Theorems that I talked about in the last two articles, and that reasoning is the essence of math. However, sometimes, you just want to know an answer, and it may even be difficult (or impossible) to try out the problem with pure math. That's where coding comes in—to confirm something you believe is true or to find an answer to a problem for you. After all, the Four-Color Theorem ended up being proven with computers!


Also, this kind of careful reasoning to find the possibilities we had to ask the computer to test is very similar to the reasoning you often have to apply in various fields of math. If you've ever seen this kind of problem,

Courtesy of MindYourDecisions

you know that the best way to approach the problem is to sort the triangles you're looking for into classes: maybe ones that contain one small triangle, ones that contain four, ones that contain nine and so on, to count up the entire total. Math reinforces programming and programming reinforces math, so you'll probably be good at one if you're good at another!


I don't claim to be any kind of expert on computer programming—I've taught myself all that I do know, but I do know some great resources to which I can direct you if you would like to learn more.


If you are interested in seeing my code, you can leave a comment, and I'll discuss it with you. And if you know how to code, why not try to write some yourself? It's a really revealing exercise.


Ok, back to the problem!

We can only find 25 numbers with the basic operations, but the Four Fours problem asks us to find a way to express ANY number with four fours. That's quite a large gap to try to bridge, but how can we bridge it? What if there were some operations we could add to the pack that would somehow give us the possibility of creating any number?


Let's try adding exponents!


How many additional numbers can you create with exponents? Just experiment; I'm not expecting you to find them all.

Courtesy of NZ Maths.

It turns out there are a few more possibilities! There are, in total, 78 numbers (with the source being my Python code) you can create if you include exponents. Here are a few of the numbers we've now added:

63 = ((4^4)-4)/4

81 = (4-(4/4))^4

240 = (4^4)-(4*4)

16384 = ((4+4)^4)*4


It makes sense that we have more possibilities. After all, at the bare minimum, we have more ways of expressing numbers we already have with a different numbers of fours. We can express 1 as 4^(4-4) now instead of just (4/4) and that gives us more ways of manipulating the fours to give more numbers.


However, 78 is still a far cry from ANY positive integer ever.


Let's try adding a few more operations.

What about concatenation? (This is just a fancy term for combining the digits together. Like we can make 44 by "concatenating" 4 and 4.) How many can you create now?


Here are a few new possibilities from that:

44 = 44*(4/4)

111 = 444/4

But the possibilities are still finite.


Here's where the key is. We need to find an operation that we only need to apply to one four. When we only use operations that are applied to two fours at a time, we're limiting ourselves to the number of possible operations we have, the three spots between fours to apply them (4#4#4#4), and the six orders in which they can be applied. The combination of those limitations is a finite number.


But with an operation that can only be applied to one number, we can apply it an infinite number of times, and it's possible that we could reach every integer. Let's look at a few of those operations.


If you use a square root, you only need one 4 to apply it to. We can magically turn any 4 into a 2 with just a square root. sqrt(4)=2, and we can, of course, go even further than that with multiple square roots.

This allows us to finally get a way to express 10 (as 4 + 4 + 4 - sqrt(4)), and to get a way to express 13 (as 44/4 + sqrt(4)).


In fact, if we allow one more operation, the factorial, which tells us to multiply all the numbers less than or equal to the number we're applying it to (so 4 factorial written 4! equals 4*3*2 = 24 and 3! equals 3*2=6), we can get another number with just one 4: 4! = 24.


This allows us to finally be able to express the first 20 integers in terms of four fours:

Courtesy of i.pinimg.com

It's your turn! Turn it wide open. Use any operations you can think of and see if you can express any number you can think of in terms of four fours. You can use addition, multiplication, subtraction, division, powers, square roots, factorials, concatenation, even things like decimal points and bars (see below) and choose functions. Anything is game here! Try writing the first 40, or the first 100, or even the first 200!

Example of bar notation

I hope you found something interesting! This is the version of the problem pretty much everybody knows. It seems limitless, and it requires so much creativity. There are plenty of stories of mathematicians whiling away a train ride or a flight by seeing how far they can get through the Four Fours problem if they start at 1 and go up. It's really fun to try to come up with a possibility on the spot, and it requires a bit of ingenuity too.

Now, with everything wide open, there's no reason you can't express any number in terms of four fours. Since we have operations that apply to one 4, we have an infinite number of possibilities.


However, we still have no reason to believe every number is possible. Perhaps, only a finite number of the infinite possibilities are legitimately positive integers (maybe the rest are fractions or negative) or we may simply skip over a particular number entirely when we apply all those combinations. What we need is a scheme, some setup that can give us all the positive integers if we tweak some aspect of it.


We're finally at the coolest part of the problem!

This problem of infinite Four Fours was actually an open problem for many, many years, until Paul Dirac, a Nobel Prize-winning physicist, defeated the puzzle by finding a solution for any value. Here's what he found:


We can take the Four Fours problem and extend it all the way to infinity! Before we start, see if you can come up with a method yourself.

Courtesy of Numberphile

The only operation we're going to need to add to our repertoire is log.


If you don't know what a log is or you need a brief refresher, just remember that a log (full name: logarithm) is basically the reverse of an exponent. We're essentially finding the power to which we need to raise a number to get another number:

Courtesy of Basic Mathematics

For example, if we know that 3^4=81, we would say that log_3(81) = 4. The base of a log (b above—usually expressed with a subscript but here with an underscore) is the number we'd be raising to some power (aka the logarithm) to get the number we're applying the log to (here, x).


Here, we're going to be using—you guessed it—log base 4 (log_4). We're also going to use log base 1/2 (log_(1/2)). The other thing we're going to be using, which I've mentioned is extremely valuable because it only needs to be applied to one number, is the square root. That's it.


One basic identity of logs is this: log_4(4^n)=n. Think of it this way: The log asks us to figure to which out what power we need to raise 4 to get 4^n. That's just n.

For example:

Courtesy of Numberphile

n does not have to be a whole number! This identity works for any value of n.


In particular, it turns out that taking a square root is the same as taking a number to the power of 1/2. Therefore, 4^(1/2) = sqrt(4) = 2 and if we apply a log to this, we get log_4(sqrt(4)) = 1/2.

Courtesy of Numberphile

Now we're on the path to the answer!


Let's continue. What if we take multiple square roots of our 4? What is, for example, log_4(sqrt(sqrt(4))? Numberphile has the answer:

Courtesy of Numberphile

What about three square roots? It turns out that log_4(sqrt(sqrt(sqrt(4))) = 1/8. And for four square roots, log_4(sqrt(sqrt(sqrt(sqrt(4)))) = 1/16. And this continues. In exactly this way by adding as many square roots as we'd like, we can get the sequence 1/32, 1/64, 1/128, and so on... Let's call this the halving sequence.


We now have a means of obtaining the entire series 1/2, 1/4, 1/8, 1/16 and so on (or in other words, 1 over any power of 2, the halving sequence), with just TWO FOURS, just by piling extra square roots onto the 4 in our log expression.

Courtesy of Numberphile

We can pile on an infinite number of square roots. But remember, we want to find a way to express any positive integer, not any number in the halving sequence. How can we turn our halving sequence into the positive integers? We'll need to employ two more fours somehow. Do you see it?


We have all the powers of 1/2 in our sequence (that is (1/2)^1 = 1/2, (1/2)^2 = 1/4, (1/2)^3 = 1/8 etc), so all we need is a way to isolate the exponents in that sequence with two additional fours... but hey, that's just another logarithm! (Remember that we said log_4(4^n) = n, and by the exact same reasoning, log_(1/2)((1/2)^n) = n. We just need to take another log (this time, base 1/2) to isolate that exponent.)

Courtesy of Numberphile

All we need to do now then is take log_(1/2) of our halving sequence. Thankfully, there's an easy way to do this with fours. We just write 1/2 = sqrt(4)/4. Then, here's the full form:

Courtesy of Numberphile

That's it. While other mathematicians were searching for factorials and choose functions and all sorts of bizarre operations to see how many numbers they could make, all it took Dirac was logs and square roots. Sometimes the most difficult problems can seem simple in hindsight.


RESOURCES:

Here's the video from Numberphile that introduced me to this little proof. I give them all credit for the idea and gifs for the last section of this article:

Go here if you want to find some solutions for the first 100 numbers:

This link has even more possibilities:

If you ever want to expand this problem, try thinking about the Six Sixes:

Courtesy of Occupy Math

Or the Five Fives:

Courtesy of Occupy Math


CONCLUSION:

I hope you enjoyed today's article. It was a little different than I normally do, as it's a puzzle that focuses more on guessing your way to an answer than anything else, but it certainly ended in a bit of brilliance, and I hope it revealed something of the insight of problem-solving.


I hope you're getting inspired this summer to pursue math (or coding or any other STEM discipline) whether it's by my articles or an entirely different source entirely, and I'd love to hear about your pursuits in the forum!


Have a great week everybody!


Cover Image Courtesy of Science ABC

0 comments
bottom of page