Skip to main content
2 of 5
added 174 characters in body
user avatar
user avatar

Four fours to get $\pi$

Four fours is a famous puzzle (made trivial with logarithms). For this puzzle, we take inspiration from Glen O's challenge from a few years back. The rules here are slightly different, but the goal is the same. Your goal is to approximate $\pi$ to the highest accuracy (per operation) as possible, using only four fours and the following operations:

  • The classic arithmetic operations: $+,-,\times,\div$
  • Exponentiation and log-base as binary operations: $\log_a b$ and $a^b$. You may only take logs of positive real numbers.
  • Unary operations: $(\cdot)!$ for integer arguments only (so you can't use $\frac12!$ to get $\sqrt{\pi}/2$), unary negation $-$, the square root $\sqrt{\cdot}$, and floor/ceiling for rounding down/up: $\lfloor\cdot\rfloor$ and $\lceil \cdot\rceil$.

Any other operations are not allowed, including double factorials and decimal points. In addition, you can do the following with no penalty:

  • Parentheses (for grouping purposes only, no binomial coefficients etc.)
  • Concatenation of 4's. That is, you can use 44 as a single number without costing an operation. You cannot concatenate things that are not fours, e.g. you can't concatenate $\sqrt{4}$ and $4!$ to get 224.
  • You do not have to use all four fours (e.g. msh210's answer is allowed).

Your score is equal to the number of digits of accuracy per operation used. That is, if you got the approximation $A$ by using $n$ operations, your score is $$ \frac{-\log_{10}|\pi - A|}{n} $$ To avoid division by 0, you must use at least one operation.


As an example, if you submit $\sqrt{(44 - 4!)/4} = \sqrt{5}\approx 2.24$, that has 4 operations, so your score would be:$$ \frac{-\log_{10} |\pi - \sqrt{5}|}4 \approx 0.01438... $$

user63779