# The Definitive Four Fours Answer Key

This is the home page of “The Definitive Four Fours Answer Key” by David A. Wheeler. I call it the “definitive” answer key, because at the time of this writing it has more answers than anybody else for the “four fours” problem. The goal of the four fours problem is to find a mathematical expression for every integer from 0 to some maximum positive integer, using only common mathematical symbols and exactly four fours (no other digits are allowed). For example, zero is 44-44, one is 44/44, 2 is 4/4+4/4, 3 is (4+4+4)/4, and so on. Since there are variations in what mathematical operations are allowed, I created an “impurity index” for each expression; see the paper for more information.

Currently, I list whole number answers from 0 up to 40,000.

You can download the definitive four fours answer key, with discussion, in PDF format. If you just want the answers, I also have them available in ASCII text format (which lists the result, the impurity level, and the mathematical expression). Note that these are large files; both are over 1.6 Megabytes, so don’t load these if you have a slow Internet connection.

If you just want a sampler of the answers, you can view the abbreviated list of answers; this one is the ASCII text format of the answers from 0 to 1,000. This sampler is only about 32K, and is better for those with slow Internet connections.

## Summary of assumptions

See the PDF version of the paper for a detailed description of my assumptions. However, here’s a quick summary of the “impurity” levels. The “zeroth” level allows digit concatenation (e.g., “44”), addition (+), subtraction/negation (-), multiplication (*), division (/), square root (sqrt(...)), factorial (!), and power (^). Parentheses may be used for grouping. The digit 4 must be used exactly four times, and the decimal digit (.) can be used. The higher impurity levels are:

• 2: The overline, an infinitely repeated digit. This is shown as a suffix ~ in ASCII text, so .4~ = 0.4444... = 4/9.
• 3: An arbitrary root power. In ASCII I write this as root(A,B) which means B^(1/A); therefore, root(.4,4) = 4**(1./0.4) = 32. Note that some systems will use the other parameter order. I use this order because it’s the left-to-right order in traditional math notation and it’s the order required by TeX (in TeX, $\sqrt[p]{a}$ is used to represent $a^{(1/p)}$).
• 4: The gamma function; gamma(x) = (x-1)! when x is a positive integer. More generally, gamma(z) = integral of 0 to infinity of t^(x-1)*e^(-t) dt.
• 5: %, a suffix meaning “divide by 100”. So 4% = 0.04. I have only allowed this suffix after a constant number, so 4%, .4%, and .4~% are fine. However, I have NOT accepted it as a general “divide by 100” operation (as it is in spreadsheet functions), so expressions like sqrt(4)% are not used in the main list of answers. Also note that I would interpret (4/4)% as “1%”, not “100%” or “100”, even if I allowed that expression.
• 6: The square function. In ASCII this is square(...), so square(4) = 16. In the PDF I use sq(...) instead because of limited space.
• 7: logical-or, exclusive-or, and logical-and. In ASCII, exclusive-or is “xor”. I’m currently not actually using logical-or and logical-and, so that is more of a future idea than a current reality.
• 8: logical left shift (<<) and right shift (>>).
I always choose the solution with the smallest impurity, then the fewest number of operations with that impurity (concatenation does not count as an operator for the purpose of counting operations). Only exact answers are acceptable. If the final result is an integer, I have also (so far) strongly preferred answers where all intermediate results are real numbers (not complex numbers). Up to this point I’ve also strongly preferred cases where the factorial function is given an integer (you can always use gamma for non-integers), though I can imagine relaxing that in the future. Other than that, I arbitrarily pick a solution. All such rules are arbitrary, of course; in particular, I’ve wondered if I should have reversed the impurity order for arbitrary roots and infinite digits, and perhaps square should have a lower impurity. However, I have to pick some rules to play a game, and I hope you’ll accept them as reasonable rules.

Some of these solutions, such as 113 and 123, are incredibly difficult to find. Here are my solutions for 113 and 123 (including their impurity levels):

  113 (4) = gamma(gamma(4))-(4!+4)/4
123 (0) = sqrt(sqrt(sqrt((sqrt(4)/.4)^4!)))-sqrt(4)


(It turns out that chemical element 113 is hard to find too.)

## Solutions from others

Some people have sent me additions.

Geoffrey Caveney has sent me an (almost) all gamma function solution for 113, gamma(gamma(4))-gamma(4)-gamma(4/4). He also noted that since gamma(2)=1 there are several "almost all gamma" solutions for 113, at least (gamma(gamma(4))-gamma(4)-gamma(sqrt(4)))*gamma(sqrt(4)), (gamma(gamma(4))-gamma(4)-gamma(sqrt(4)))/gamma(sqrt(4)), and (gamma(gamma(4))-gamma(4)-gamma(sqrt(4)))^gamma(sqrt(4)).

A special thank-you goes to Colin Harkins, who reported a whole lot of additions to me in 2018!

I intend to fold them in eventually, but for now, additions from others (some of which use additional functions) are:

93 (0) = (4 - sqrt(sqrt(sqrt(sqrt(4^ - 4!))))) * 4!   [Colin Harkins]
99 (0) = ((sqrt(sqrt(sqrt(sqrt(4))))^-4!)+4)*4!
using a negative exponent]
He has another solution that interprets (4/4)% as "100", but I
don't accept that approach and in any case I would interpret
(4/4)% as 1% = 0.01, not as 100, even if I accepted it.
197 (5) = (4-(4!/4)%)/sqrt(4)%                 [Anthony Bailey, better than 6]
HOWEVER: this uses "%" as a general "divide by 100" operation,
which I have avoided in the main answers.
239 (0) = ((4!*4)-.4)/.4                       [Jay N. Giedd]
299 (0) = ((sqrt(4) / .4)! – .4) / .4   [Colin Harkins]
343 (0) = sqrt(sqrt(sqrt((sqrt(4) / .4 + sqrt(4))^4!)))   [Colin Harkins]
351 (0) = 4!/sqrt(sqrt(sqrt(.4^4!)))-4!        [Colin Harkins]
371 (0) = 4!/sqrt(sqrt(sqrt(.4^4!)))-4         [Colin Harkins]
373 (0) = 4!/sqrt(sqrt(sqrt(.4^4!)))-sqrt(4)   [Colin Harkins]
377 (0) = 4!/sqrt(sqrt(sqrt(.4^4!)))+sqrt(4)   [Colin Harkins]
379 (0) = 4!/sqrt(sqrt(sqrt(.4^4!)))+4         [Colin Harkins]
383 (2) = (4^4 - sqrt(.4~))/sqrt(.4~)   [Colin Harkins]
385 (2) = (4^4 + sqrt(.4~))/sqrt(.4~)   [Colin Harkins]
397 (5) = (4+4-gamma(4)%)/sqrt(4)%             [Anthony Bailey, better than 6]
HOWEVER: this uses "%" as a general "divide by 100" operation,
which I have avoided in the main answers.
399 (0) = 4!/sqrt(sqrt(sqrt(.4^ 4!)))+4!       [Colin Harkins]
427 (5) = sqrt(4) / .4~% - 4! + gamma(sqrt(4))   [Colin Harkins]
437 (2) = (sqrt(4) - 4%) / .4~% - 4   [Colin Harkins]
461 (5) = sqrt(4)/.4~%+sqrt(gamma(gamma(4))+gamma(sqrt(4))   [Colin Harkins]
462 (0) = (4! - sqrt(4))! / (4! - 4)!   [Colin Harkins]
495 (2) = (4! - sqrt(4)) / (.4~ - .4)   [Colin Harkins]
507 (4) = gamma(4!) / (gamma(4! – sqrt(4))) + gamma(sqrt(4))   [Colin Harkins]
519 (5) = gamma(4) - (gamma(sqrt(4) / .4~%) + 4!   [Colin Harkins]
525 (2) = (4! - sqrt(.4~)) / (.4~ - .4)   [Colin Harkins]
531 (2) = (4! - .4) / (.4~ - .4)   [Colin Harkins]
538 (2) = (4! / (.4~ - .4)) - sqrt(4)   [Colin Harkins]
542 (2) = (4! / (.4~ - .4)) + sqrt(4)   [Colin Harkins]
549 (2) = (4! + .4) / (.4~ - .4)   [Colin Harkins]
555 (2) = (4! + sqrt(.4~)) / (.4~ - .4)   [Colin Harkins]
563 (5) = ((gamma(sqrt(4)) / .4~%) + sqrt(4%)) / .4   [Colin Harkins]
573 (0) = (4! - sqrt(sqrt(sqrt(sqrt(4^-4!))))) * 4!   [Colin Harkins]
579 (0) = (4! + sqrt(sqrt(sqrt(sqrt(4^-4!)))))*4!   [Colin Harkins]
641 (0) = (4^4 + .4) / .4   [Colin Harkins]
789 (5) = ((4% + 4) / .4~%) - gamma(gamma(4))   [Colin Harkins]
797 (5) = ((gamma(gamma(4)) * .4~) - sqrt(4%)) / sqrt(.4~%)   [Colin Harkins]
803 (5) = ((gamma(gamma(4)) * .4~) + sqrt(4%)) / sqrt(.4~%)   [Colin Harkins]
853 (5) = (4 - sqrt(4%)) / .4~% - sqrt(4)   [Colin Harkins]
857 (5) = (4 - sqrt(4%)) / .4~% + sqrt(4)   [Colin Harkins]
859 (5) = (4 - sqrt(4%)) / .4~% + 4   [Colin Harkins]
863 (2) = (4! * 4! - sqrt(.4~)) / sqrt(.4~)   [Colin Harkins]
865 (2) = (4! * 4! + sqrt(.4~)) / sqrt(.4~)   [Colin Harkins]
877 (5) = 4 / .4~% - 4! + gamma(sqrt(4)   [Colin Harkins]
883 (5) = (4 - sqrt(.4~%)) / .4~% - sqrt(4)   [Colin Harkins]
889 (5) = (4 - sqrt(.4~%)) / .4~% + 4   [Colin Harkins]
892 (5) = 4 / .4~% - 4 - 4   [Colin Harkins]
893 (5) = 4 / .4~% - gamma(4) - gamma(sqrt(4))   [Colin Harkins]
907 (5) = (4% + 4) / .4~% - sqrt(4)   [Colin Harkins]
911 (5) = (4% + 4) / .4~% + sqrt(4)   [Colin Harkins]
913 (5) = (4% + 4) / .4~% + 4   [Colin Harkins]
914 (5) = (4 + sqrt(.4~%)) / .4~% - gamma(sqrt(4)   [Colin Harkins]
917 (5) = (4 + sqrt(.4~%)) / .4~% + sqrt(4)   [Colin Harkins]
919 (5) = (4 + sqrt(.4~%)) / .4~% + 4   [Colin Harkins]
921 (5) = (4 + sqrt(.4~%)) / .4~% + gamma(4)   [Colin Harkins]
922 (5) = (4 / .4~%) + 4! - sqrt(4)   [Colin Harkins]
923 (5) = (4 / .4~%) + 4! - gamma(sqrt(4))   [Colin Harkins]
926 (5) = (4 / .4~%) + 4! + sqrt(4)   [Colin Harkins]
933 (5) = (4% + 4) / .4~% + 4!   [Colin Harkins]
939 (5) = gamma(sqrt(4)) / .4~% + gamma(4)! - gamma(4)   [Colin Harkins]
941 (5) = gamma(sqrt(4)) / .4~% + gamma(4)! - 4   [Colin Harkins]
943 (5) = gamma(sqrt(4)) / .4~% + gamma(4)! - sqrt(4)   [Colin Harkins]
947 (5) = gamma(sqrt(4)) / .4~% + gamma(4)! + sqrt(4)   [Colin Harkins]
949 (5) = gamma(sqrt(4)) / .4~% + gamma(4)! + 4   [Colin Harkins]
955 (5) = 4 / .4% - sqrt(4%) / .4~%   [Colin Harkins]
990 (2) = 44/(.4~-.4)                          [Roger Webber]
951 (0) = 4!*(4!+sqrt(sqrt(sqrt(.4^(-4!)))))   [Roger Webber]
5417 = Φ(Φ(Φ(Φ(sq(sq(sq(4)))))))+ Γ(√ 4)+4!+sq(sq(Γ(4))) [Arsenic]
9573 = sq(gamma(4))/.4%+sq(4!)-pi(gamma(4)) [Arsenic]
29675 = gamma(gamma(4))/.4%-sq(pi(phi(phi(sq(sq(4)))))-gamma(sqrt(4)) [Arsenic]
29677 = gamma(gamma(4))/.4%-sq(pi(phi(phi(sq(sq(4)))))+gamma(sqrt(4)) [Arsenic]


In the paper I mention some possible extensions; one possibility is using Euler's totient function phi(n). Geoffrey Caveney investigated using this phi() function and shared a number of observations with me. First, he noted that no existing combination of functions and operations seems to be able to express 2179, 2227, 2263, 2467, 2611, etc., with four fours, while they can also be solved with phi. He shows that the phi function can express 2304 with just one four: gamma(4) = 6. He then showed some other useful values that can be derived with phi, including:

sq(gamma(4)) = 36
phi(sq(gamma(4))) = 12
sq(phi(sq(gamma(4)))) = 144
phi(sq(phi(sq(gamma(4))))) = 48
sq(phi(sq(phi(sq(gamma(4)))))) = 2304
phi(4!) = 8
phi(gamma(gamma(4))) = 32
sq(phi(4!)) = 64
phi(sq(sq(4))) = 128
phi(gamma(4)!) = 192
phi(sq(sq(gamma(4)))) = 432

It is also important to note that because phi(2^n) = 2^(n-1), any power of 2 can be expressed with just one four, with the repeated application of the square function followed by the repeated application of the phi function. For example,
phi(phi(phi(phi(phi(phi(phi(sq(sq(sq(4)))))))))) = 512
phi(phi(phi(phi(phi(phi(sq(sq(sq(4))))))))) = 1024
phi(phi(phi(phi(phi(sq(sq(sq(4)))))))) = 2048

The expression for 2304 with one four in particular allows us to express the four smallest unsolved numbers with four fours:
2179 = sq(phi(sq(phi(sq(gamma(4))))))-gamma(gamma(4))-sqrt(4)/.4
2227 = sq(phi(sq(phi(sq(gamma(4))))))-phi(gamma(gamma(4)))-gamma(4)!/sq(4)
2263 = sq(phi(sq(phi(sq(gamma(4))))))-sq(gamma(4))-4-gamma(sqrt(4))
2467 = sq(phi(sq(phi(sq(gamma(4))))))+phi(sq(sq(4)))+sq(gamma(4))-gamma(sqrt(4))
The next unsolved number requires somewhat more extensive use of the phi function:
2611 = phi(phi(phi(phi(phi(sq(sq(sq(4))))))))+sq(4!)-phi(sq(gamma(4)))-gamma(sqrt(4))

In addition, here are solutions for some important non-integers (here non-real complex numbers are just fine as intermediate results); many were provided by others:

pi (0) = (sqrt(4)/4)!^sqrt(4)*4 [Colin Harkins]
This exploits the fact that (1/2)! = sqrt(pi)/2, which only works
if you accept non-integer factorials (per the gamma function).
tau [2*pi] (4) = gamma(sqrt(4)/4)^sqrt(4)*sqrt(4) [Colin Harkins]
Golden ratio (4) = gamma(sqrt(4)+(sqrt(4)/.4))/sqrt(4) [Colin Harkins]
This is based on the golden ratio's algebraic representation (1+sqrt(5))/2.
i (0) = sqrt(4-4-4/4) [Colin Harkins]
This one is easy, but it is listed for completeness.
You can get -i by just inserting "-" at the beginning of the expression.
e (6) = root(square(gamma(sqrt(4)/4))*sqrt(-gamma(sqrt(4))),-gamma(sqrt(4)))
[David A. Wheeler and Colin Harkins]
This is tricky.  Since e^(pi*i)+1=0, then root(pi*i,-1) is e.
To create the piece parts we can use gamma(.5)=sqrt(pi) and gamma(2)=1.
sqrt(2) (0) = sqrt(4/4+4/4) [David A. Wheeler]


There are many related problems, such as selecting four digits other than four fours, or allowing up to four digits. Geoffrey Caveney has identified many interesting properties from using the digits 1,2,3, and 4 exactly once each.

## Related Sites

Other sites that discuss the four fours problem (or related problems) include the comp-sci collection, Paul Bourke’s collection (with Frank Mrazik) (but note that some solutions use non-standard notation!), the collection of “interesting” solutions at wheels.org, and the Math Forum/Ruth Carter’s list at Pete Karsanow’s Four Fours FAQ. Anthony Bailey has some answers with a similar but not identical notion of purity. There is also a page emphasizing solutions based on the book for Texas Instruments (TI) calculators (note: this site has download limitations and sometimes isn’t available). Mathnet discusses the Four Fours Problem too. Note that there are many variations in the rules (e.g., some allow fewer than four fours, or different operations). Heiner discusses a variant called the “year puzzle.”

A related paper is ”Single Digit Representations of Natural Numbers” by Inder J. Taneja

The first known occurrence of this puzzle in print is in “Mathematical Recreations and Essays” by W. W. Rouse Ball, published in 1892. Ball describes it as a “traditional recreation”.