How To Generate Any Number Using Four 4s? - An image with a row of four 4s equating to 99. There is a question mark hovering above the 'equal to' sign which seems to question the relationship between the four 4s.

There is an old saying that goes: “One who masters the four 4s shall not fear the vilest of the mathematical demons!” Actually, that is not an old saying. I just made it up now as an excuse to spend some time solving an intriguing math puzzle.

But in my defense, we are not looking at an arbitrary math puzzle here but the “four 4s puzzle”. Its rules are pretty simple. You have a row of four 4s. You are allowed to use mathematical operations to relate these 4s with each other to arrive at any non-negative integer possible. The 4s can be related to each other using any arbitrarily valid mathematical operator. That is pretty much it.

We will start with the first ten integers from zero to nine. To do this, we will be restricting ourselves to the following fundamental operations: addition (+), subtraction (-), multiplication (*), and division (/).

Following this, I will demonstrate how bigger integers need more advanced operators. Finally, I will show how you can achieve a general solution that can be applied to any positive integer.

This essay is supported by Generatebg


The Four 4s Puzzle — The First ten Integers

The first eleven integers are relatively straightforward. I’ve worked out the first integer (zero) as an example below. Based on this, you may choose to work out the rest of the integers (1–9) on your own. Remember that for these integers, the four fundamental mathematical operators and parenthesis (+, -, *, /, and ‘( )’) are sufficient.

How To Generate Any Number Using Four 4s?: 4–4+4–4
Math illustrated by the author

Furthermore, please note that the solutions for this puzzle are not unique. That means that your solution and my solution need not be the same; there are numerous ways to obtain the same results.

Spoiler alert: Beyond this point, I will be revealing the solutions to the rest of the integers from 1–10 directly. So, if you wish to move away from this essay and work out solutions on your own, now is the time to do it. You may then come back later to compare your answers.

The four 4s puzzle: 4–4+4–4=0; (4/4)+4–4=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
Math illustrated by the author

The Four 4s Puzzle — Bigger Integers

Unfortunately, as soon as we expand our scope beyond the integers we have just covered, the four fundamental operators and parenthesis are no longer sufficient. To do the job, here is the list of operators most commonly used:

The four 4s puzzle — Addition (+), subtraction (-), multiplication (*), division (/), parenthesis (‘( )’), percentage (%), factorial (!), square root (√), decimal point (.), exponentiation (x^y), and concatenation (x||y -> xy)
Math illustrated by the author

As an illustration, consider the question asked in the title image.

Which combination of four 4s leads to 99?

The four 4s puzzle — (4/4%)-(4/4) = 99
Math illustrated by the author

Apart from this, I came across mathematicians using a variety of other mathematical operators as well to get the job done. But why stop there? Why not look for a more general solution? That is exactly where we are headed.


The Four 4s Puzzle — General Solution

You see, the Four 4s puzzle is relatively old (dates back to the late 19th century). Back in the early 1900s, the famous physicist Paul Dirac took interest in this puzzle and found a general solution for all positive integers. Dirac managed to solve the puzzle using only logarithms and radicals (square root).

To begin understanding his genius solution, we’ll need to cover two fundamental parts first.

The first part is to merely understand how logarithms to the base 4 work. We don’t normally use logarithms to the base 4, but for our purposes here, they are essential.

The four 4s puzzle —log_4(4)=1; log_4(16)=2; log_4(64)=3…log_4(4^n)=n
Math illustrated by the author

The second part is to extend our current level of understanding to logarithms of base ½.

The four 4s puzzle -log_½(½)=1; log_½(½)²=2; log_½(½)³=3…log_½(½)^n=n
Math illustrated by the author

As a final touch, we express ½ as √4/4 (which is nothing but 2/4). Now, we have all the ingredients necessary to understand Dirac’s general solution, which is expressed as follows:

The four 4s puzzle — log_√4/4[log_4(√4)]=1;log_√4/4[log_4(√√4)]=2;log_√4/4[log_4(√√√4)]=3…log_√4/4[log_4(…√√√4)]=n (for ’n’ number of inner square roots (radicals))
Math illustrated by the author

As you see, we have four 4s in this expression, and the number of square roots inside the parenthesis decides the value of n. To obtain any arbitrary integer, we just need correspondingly many square roots placed inside.

Final Thoughts

When I first came across this puzzle, it looked quite harmless to me. As I went through bigger and bigger integers, I began understanding the scale of the challenge in this puzzle.

So, it is no wonder that great mathematical minds such as Dirac took turns at this puzzle. If you figured out interesting approaches to the puzzle, do share them in the comments section. I hope that you had as much fun solving this puzzle as I did!


References: Colin Foster and Alex Bellos.

If you’d like to get notified when interesting content gets published here, consider subscribing.

Further reading that might interest you: How To Mentally Calculate Cube Roots As 2-Digit Integers? and  How To Really Solve The Three 3s Problem? 

Street Science

Explore humanity's most curious questions!

Sign up to receive more of our awesome content in your inbox!

Select your update frequency:

We don’t spam! Read our privacy policy for more info.