$$ \definecolor{red44}{RGB}{255, 109, 107} \definecolor{green44}{RGB}{49, 207, 140} \definecolor{blue44}{RGB}{117, 184, 255} \definecolor{purple44}{RGB}{175, 112, 255} \definecolor{yellow44}{RGB}{244, 194, 13} $$

About

Four fours is a classic mathematical problem where the goal is to find the simplest mathematical expression of every non-negative number using only a combination of exactly four 4s and common mathematical operators.

fourfou.rs was a project I started out of boredom to teach myself web development.

Levels

Each solution in this website has a complexity level that determines how "complex" the solution is. Lower level expressions are considered simpler and thus better than higher level expressions. Each level has a set of allowed operators in addition to allowing the operators from the previous levels.
The levels are described below:


Level 0

Allows addition, subtraction, multiplication, division, square root1, power, factorial, decimals2, and concatenation3 $$+ , - , \times , / , \sqrt{x}, x^{y}, !, .4, 44$$

Level 1

Allows repeating decimal2 $$.\overline{4} = 4/9$$

Level 2

Allows the arbitrary root $$\sqrt[y]{x} = x^{1/y}$$

Level 3

Allows the percent sign4 $$x\% = x / 100$$

Level 4

Allows the gamma function $$\Gamma(x) = (x - 1)!$$

Level 5

Allows the square function $$sq(x) = x^{2}$$


1Note: Using an infinite amount of square roots or other unary operators (e.g. \(\sqrt{\sqrt{...\sqrt{4}}} = 1\) ) is not allowed.
2Note: Decimalizing an expression such as \(.(4 + 4) = .8\) or \(.(4!) = .24\) is not allowed.
3Note: Concatenating expressions such as \(4||(4 + 4) = 48\) or \((4! - 4)||(4 - 4) = 200\) is not allowed.
4Note: Using a percent sign on an expression such as \((4 + 4)\% = 0.08\) and \((.4)\% = 0.004\) is allowed.


All solutions levels 0 to 5 are valid solutions. Solutions that use operators or functions outside of the ones listed above will be considered "semi-valid" and will have a complexity level of 6. For example:

$$69 = \phi(\Gamma(\Gamma({\color{red44}4})) + {\color{green44}4}) + {\color{blue44}4} / .\overline{{\color{purple44}4}}$$
would have a complexity level of 6 because \(\phi\) (Euler's totient function) is not an operator listed above.

Similarly, solutions that use the existing operators in a way that is disallowed, such as decimalizing expressions, will also fall under this category. For example:
$$69 = (\Gamma(\Gamma({\color{red44}4})) - \Gamma({\color{green44}4}) + \Gamma(\sqrt{{\color{blue44}4}})) \times .(\Gamma({\color{purple44}4}))$$
would have a complexity level of 6 because an expression is decimalized (Specifically \(.(\Gamma(4)) = .6\)).



Banned Operators

These following operators are explicitly banned and cannot be used in any solution valid or semi-valid:

Log Functions

Includes \(log_{y}(x)\) and \(ln(x)\)

These are banned because there are many ways to break the challenge using the function. For example:

$$x = log_{\sqrt{4}/4}(log_{4}(\sqrt{\sqrt{...\sqrt{4}}}))$$
can get any number \(x\), by adding \(x\) amount of nested square roots on the last 4. A more detailed explanation can be found here.


Trig Functions

Includes \(sin(x)\), \(cos(x)\), \(tan(x)\), \(sec(x)\), \(csc(x)\), \(cot(x)\) and their respective inverses

(Credit to Jim Millar) These are banned because all numbers above 4 can be created with a single 4 using this equation:

$$x = sec(atan(...(sec(atan(4)))))$$
To get any number \(x\), you can make \(x^{2} - 16\) amount of nested secants and inverse tans on the 4. A more detailed explanation can be found here.


Increment and Decrement Operators

Includes \(++\) and \(--\)

These are banned because all numbers can be created with a single 4 using these operators:

$$x = 4++...++$$
$$x = 4--...--$$


Numeric Constants

Includes \(\pi\), \(e\) and more

These are banned because they are representative of another number that isn't 4.




Contact Me

If you found a mistake or have a solution you want to submit that meets one of these requirements:

you can contact me at timsin4444@gmail.com. Also contact me if you have any general inquiries about this website and I hope to answer the best I can!