Four Four's Problem

The Four Four's Problem:

What is the lowest number that cannot be expressed using mathematical symbols and using the number four up to four times?

For example,
2=(4/4) + (4/4)
3=(4 + 4 + 4)/4
4=(4-4)*4 + 4

The Answer:

It depends!

The answer depends on what mathematical symbols are allowed. My answers are listed at the end. At the time I writing this (March 2007), these are more definitive than anything I can find on the Internet.

Allowable Mathematical Symbols

I use the following impurity (I stole this term from David Wheeler's web site) levels to denote the different mathematical symbols that are allowed:

The different levels are arbitrary and they are based on when I was exposed to the particular symbol. Other Internet sites use similar concepts. I believe that all symbols up through level 4 should be allowed. Personally, I would allow sub-factorials, but not gamma functions; however, the concensus of various web sites is to allow gamma functions, but not sub-factorials. My rationale is simple: these were all symbols I was introduced to at high school math level, even the sub-factorial. I was never exposed to the gamma function at high school maths, or even the first year of college maths, but perhaps I was sleeping that day.

There is a good argument for allowing triangle numbers, however there is not a common mathematical symbol for it. Some would argue that the Greek Sigma character (Σ) or Delta (Δ) is the common mathematical symbol. If you allow a symbol that is the product of all numbers less than or equal to n (n!), then how can you exclude a symbol that is the sum of all numbers less than or equal to n?

I do not allow unusual decimal point numbers. I use .4=2/5, .4R=4/9, and sqrt(.4R)=2/3. I do not allow anything that starts ".(", for example I do not allow .(4!) which is supposed to represent .24.

I do not allow the percent character. Expressions such as sqrt(4%) look alien to me - I do not know what number this is supposed to represent. I can almost see using 4%(something), but not x/4%.

There are some interesting symbols that we could add to the problem

I do not allow binary operators such as XOR, OR, AND as these also seem unusual when working in a decimal system.

My History

I first saw this problem in a maths class about age 12 (ug, about thirty years ago) and dutifully attempted the various numbers. I can't remember the highest number that I got to. I decided that one day I'd use a computer to help me find the answer and that day finally arrived. I did all the coding and testing before checking other Internet sites to see what was out there - I already had something similar to "impurity level" in my code.

I've seen different reports on the original history of the problem. One site states that it appears in "The Schoolmaster's Assistant: Being a Compendium of Arithmetic Both Practical and Theoretical" (first edition c. 1744), a popular textbook by the English schoolteacher and cleric Thomas Dilworth (d. 1780) (reference). According to this site, the allowed operations correspond to those allowed up to (my) level 3 (unsure if the arbitrary root power is allowed).

Other sites (Wikipedia) claim the first reference is in "Mathematical Recreations and Essays" by W. W. Rouse Ball published in 1892.

Other Sites

After I completed the work (I created a computer program to generate the various numbers), I did some research on the other sites on the Internet. This search was done in mid March 2007. This is my analysis of the sites that came up (in order of a Google search):

Other sites: The Definitive Four Fours Answer Key ( by David Wheeler.

Unfortunately, this isn't as definitive as the work I have.

David uses the following "impurity levels":

His level 4 corresponds with my level 4a. He only lists numbers up to 40000. My level 4a includes all of the numbers that he has in level 4. The first ten numbers that he uses level 5 or above are 197, 379, 395, 397, 413, 427, 437, 461, 467, 493. As an example, I can create some of these numbers using (his) level 4 operators.

I also have the following numbers in my level 4a that David does NOT have in his "definitive" list:

There are many more - I counted over 140 separate numbers under 40,000 that I have an entry for that David does not.

Other sites:

This uses various operators, including %, without impurity levels so it is difficult to compare. It does not use the gamma function or sub-factorial. The first few missing numbers on the list are 1203, 1205, 1207, 1208, 1209 Using the same criteria as this site (% is allowed), the first few missing numbers on this site can be created as follows
1207:((.(4!)R-(sqrt(4)%)%R)/(sqrt(4)%)%R) - 4
1208:(4!/sqrt(4)%) + 4 + 4
1209:(4!/sqrt(4)%) + 4/.4R
The site only lists 12 numbers between (1200-1299) inclusive. I have at least 90 using the same criteria that is allowed on this site. I don't have answers for 1229 1241 1267 1268 1271 1273 1277 1293. As stated earlier, I don't like the "%" character so I have not done a full comparison with this site.

Other sites:

This uses the same symbols as my level 3. Only the numbers 0-116 are listed. 113 is the lowest (and only) number not listed. I have the same results. The next number I cannot list is 157.

Other sites: Wikipedia

There are some results on Wikipedia's page, but none are as definitive as mine. Perhaps one day someone will update the Wikipedia entry to point here...

My Results

These results show the lowest number using up to four four's. The number of fours column shows the number of entries that use that number of fours. The highest number I track is arbitrary - once you allow the ! symbol then an infinite number of numbers can be created.

Table of Answers to Four Four's Problem
Level Symbols allowed Results Number of 4s Ten lowest numbers that are not listed
1 2 3 4 Total
0 +-*/ Level 0 Results 1 4 12 30 47 13 14 18 19 21 22 23 25 26 27
1 sqrt(), ".4", ".4R" Level 1 Results 2 10 49 352 413 31 51 57 58 59 61 71 73 74 76
2 n! Level 2 Results 3 33 318 3502 3856 113 157 163 166 167 171 173 185 187 191
3 .4sqrt() Level 3 Results 3 34 323 3561 3921 113 157 163 166 167 171 173 185 187 191
4a gamma(n) Level 4a Results (0.8Mb) 7 87 1232 18081 19407 197 395 397 413 427 437 467 493 499 501
4b !n but not gamma(n) Level 4b Results (3.4Mb)
gzip version (0.8Mb)
11 189 3840 79697 83737 878 881 893 917 943 946 947 1019 1109 1139
5 gamma(n) and
!n (sub-factorial)
Level 5 Results (6.1Mb)
gzip version (1.4Mb)
13 263 5985 139531 145792 878 893 947 1139 1207 1213 1214 1217 1243 1267
6 tri(n) Too big (426Mb) 35 2436 157514 8665171 8825156 13117 15677 17077 18689 19013 19343 19753 20443 21314 22073

The format of the results file may be a little difficult to read. The first entry is the number represented with the fewest number of fours and the impurity level. The second part of the entry is the number represented with four fours at the lowest impurity level. I have kept everything in text files. Also, it keeps the file shorter to represent the number using the intermediate number. For example, 1457 = 1458 - 1. To find the actual representation using fours, you have to look up the number 1458 and the number 1. 1458 = 2 * 729. Eventually you get to 1457 = sqrt(4)*(sqrt(sqrt(sqrt((!4)^4!)))) - !(sqrt(4)).

The results in level 5 assume that impurity level 4 is the gamma function and impurity level 5 is the sub-factorial.

Future Work

There are still some combinations of four fours that I have not programmed yet. Therefore, this work is still incomplete and is not definitive. I leave it up to the reader to work out which combinations these are! (I have to leave you something to do else this problem gets boring)

The interesting programming challenges were working with large numbers and keeping the code compact. The other interesting aspect was the size of the data. I did the work on a 512Mb machine - lots of tricks to keep the program reasonably fast. If you start working on this, suggest you always use fractions for computation (when comparing two numbers, you have to consider .4 and .4R). Also suggest using a good "back-end" to store all of the data that is being generated.

It is possible that I have some of the numbers wrong (I hope not, but anything is possible). In some cases (particularly when dealing with fractions), I hard-coded the fraction in the code. Some errors crept in to my first attempts at this because of integer wrap-around - I think I now have appropriate checks in the code for this but it's possible I have missed one. It is also possible that I have the correct function in the code, but when outputing the function, I failed to correct some cut/paste errors. If you notice anything that is wrong, please let me know so I can correct it.

As of today, this is the most complete list on the Internet.

If you need to know the result with, or without, a particular function, and I've got enough time, then I might be able to create the answer.

Last updated: February 4, 2017