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,
1=44/44
2=(4/4) + (4/4)
3=(4 + 4 + 4)/4
4=(4-4)*4 + 4

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:

• Level 0: Allow the symbols +-*/ and brackets.
• Level 1: Allow the square root symbol, ".", ^ (exponential - to the power of) and R (for recurring). For example, sqrt(4)=2, (4/.4)=10, 4^4=256, .4R=0.444444444. It is easy for me to use R rather than the symbol "." or "_" (depends which symbol you are used to using - the symbol typically goes above the number). .4R is useful for (4/.4R)=9. Also, (4/.4)=10. Allowing exponential and recurring fractions allows expressions such as (.4)^(-4)=(2/5)^-4=(5^4)/(2^4)=625/16=39.0625
• Level 2: Allow factorial. n!=n * (n-1) * (n-2) .... * 1. 1!=1, 2!=2, 3!=6, 4!=24, 5!=120 etc.
• Level 3: Allow the .4 square root. I use sqrt() to represent the square root as the square root symbol √ is not part of standard ASCII. For example, .4sqrt(4)=32. Written mathematically as .4 √4 = 32. The general formula is .4sqrt(n)=n^(5/2). If you allow .4 square root, then you also need to allow .4Rsqrt(n)=n^(9/4) and sqrt(.4R)sqrt(n) = n^(3/2).
• Level 4a: Allow gamma numbers. Gamma(n)=(n-1)!. For example, gamma(4)=6.
• Level 4b: Allow sub-factorials but not gamma numbers. For even numbers, !n=n*!(n-1)+1. For odd numbers !n=n*!(n-1)-1. !1=0, !2=1, !3=2, !4=9, !5=44. The sub factorial is the number of ways a postman can deliver n letters, each addressed to a unique house, to n houses such that each house gets one letter and it is not a letter addressed to them.
• Level 5: Allow sub-factorials and gamma numbers.
• Level 6: Allow triangle numbers. tri(n)=n + (n-1) + (n-2) + ... 1. tri(1)=1, tri(2)=3, tri(3)=6, tri(4)=10. A shorter calculation is tri(n) = n*(n+1)/2.
• Level 7: Allow sub-factorials and gamma numbers.

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

• Knuth arrows, where 2↑↑2 is 2^(2^2) = 2^4 = 16. More generally, n↑↑m = n^(n^(n^(.... m times). As an example:
4↑↑4=4^(4^(4^4)))=4^4^(256).
This is clearly a very large number. Using multiple square root symbols, it is possible to create number representing 4^n, where n is a power of 2. Thus, 4^2=16, 4^4=256, 4^8=65536. If we start with the number 2, then we can create 2^m where m is a power of 2 using only two fours. Thus, 2^2=4, 2^4=16, 2^8=256, 2^16=65536.
• Steinhaus-Moser notation. Putting a number inside a triangle means n^n. So SMtri(3)=3^3=27, SMtri(4)=256. Using this we can get 256 using only one 4, and by using square root we can get 16.

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 (http://www.dwheeler.com/fourfours/) by David Wheeler.

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

David uses the following "impurity levels":

• 2: Recurring decimals
• 3: Arbitrary root power
• 4: Gamma function
• 5: %
• 6: Square function
• 7: Logical-or, exclusive-or and logical-and
• 8: Logical left shift right shift

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.

• 379: (4!/(sqrt(sqrt(sqrt(.4^4!))))) + 4
• 461: sqrt(212521) = sqrt( (gamma(4!)/gamma(4!-4)) + gamma(sqrt(4)))

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

• 507: gamma(sqrt(4)) + gamma(4!)/gamma(4!-sqrt(4))
• 1226: gamma(4)! + gamma(4!)/gamma(4!-sqrt(4))
• 1265: (gamma(4!)/gamma(4!-sqrt(4))) / .4

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: http://local.wasp.uwa.edu.au/~pbourke/fun/4444/

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
1203:4+((4!-sqrt(4)%)/sqrt(4)%)
1205:4+((4!+sqrt(4)%)/sqrt(4)%)
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: http://www.wheels.org/math/44s.html

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