# Making π from 1 2 3 4 5 6 7 8 9

There have been two other questions here and here that are similar to this one, but this changes the rules up a little.

Your job is to approximate $\pi$ using the sequence of digits (in order):

1 2 3 4 5 6 7 8 9

with operators inserted between them (permitted operators listed below). You are to find the best approximation to $\pi$ that you can using the allowed operators and the numbers listed in order as they appear above. You must use all nine digits.

Your score is given by $$\frac{-\ln\left|1-A/\pi\right|}{n_{ops}} = \frac{\ln\left|\frac{\pi}{\pi-A}\right|}{n_{ops}}$$ where $n_{ops}$ is the number of operators you used, and $A$ is your approximation. So if you managed to get $A=22/7$ and required three operations, then we have $\ln\left|1-A/\pi\right|\approx−7.818$, and so your score would be approximately $2.606$. Larger scores are better.

You may use parentheses, but only to control order of operations - other uses such as binomials or Jacobi symbols are not valid.

Permitted operations:

• $+$ (plus): standard addition of real or complex numbers.
• $-$ (minus): standard subtraction of real or complex numbers, or unary negation of real or complex numbers.
• $\times$ (times): standard multiplication of real or complex numbers. Implied multiplication (e.g. $(1+2)3$) counts as an operation.
• $/$ or $\div$ (divide): standard division of real or complex numbers (allows division by positive or negative infinity to get zero).
• $\sqrt{ }$ (square root): standard principle square root of real or complex numbers, with second root (negative if number being square rooted is positive) allowed as $\sqrt[-]{}$ as a single operation.
• $!$ (factorial): standard factorial for non-negative integer values (i.e. natural numbers) only, cannot be applied to non-natural numbers.
• $|.|$ (absolute value): standard absolute value for real or complex numbers, equal to $\sqrt{a^2+b^2}$ if the number is of the form $a+bi$ with $a$ and $b$ real and $i$ being the imaginary number.
• $\lfloor.\rfloor$ (floor): standard round-downwards to integer for real numbers only.
• $\lceil.\rceil$ (ceil): standard round-upwards to integer for real numbers only.

Permitted operations but counting as three operations:

• $^\wedge$ (exponentiation): standard exponentiation of real and complex numbers with integer powers only. Note that $0^0$ cannot be used.
• $\ln(.)$ (natural log): standard natural logarithm of positive real numbers only.

Note the restrictions on some operators - This is primarily to ensure that exact values of $\pi$ cannot be obtained, as well as ensuring that the operations are well-defined.

If you feel that a reasonable operation has been left out, mention it in the comments and I may add it.

I will also upvote people who obtain high accuracy using many operations, in addition to those who get a good score, and encourage others to do likewise.

I'm also going to keep track of the best answers for each number of operations, up to 10.

$$\begin{matrix} \underline{\text{Operations}} & \underline{\text{Score}} & \underline{\text{User}}\\ 1 & 0.864669301 & \text{pacoverflow}\\ 2 & 1.272568270 & \text{pacoverflow}\\ 3 & 1.501203245 & \text{Ben Frankel}\\ 4 & 2.254197410 & \text{Ben Frankel}\\ 5 & 2.286460415 & \text{Lynn}\\ 6 & 2.713605107 & \text{Lynn}\\ 7 & 2.151734961 & \text{Lynn}\\ 8 & 2.135316968 & \text{Ben Frankel}\\ 9 & 2.063009554 & \text{Ben Frankel}\\ 10 & 2.186087400 & \text{Glen O} \end{matrix}$$ Let me know if I've missed one.

• I think you should review your scoring algorithm. If I submit $A=123456789$ with no operations I get an infinite score. If that is not allowed, I could do $A=12^{3456789}$ and get a score a little over $2.86 \cdot 10^6$ – Ross Millikan Apr 17 '15 at 16:58
• I felt free to add a condition to the problem: at least one operation is required! This is to prevent 0 operation from being the best answer. If you don't agree with my edit, simply remove that condition and I'll be happy as well. – leoll2 Apr 17 '15 at 17:51
• @RossMillikan I think I can top that with A = 12^3^4^5^6^7^8^9 ;-) – Mark N Apr 17 '15 at 18:00
• You definitely want $-\ln|\dots|$, not $|\ln|\dots||$. The latter bounces off the y axis and goes back up to infinity when you're really far off. – Lynn Apr 17 '15 at 19:28
• @MarkN: Yes, I thought about that. I tried $12^{3^{456789}}$ but couldn't evaluate the score. – Ross Millikan Apr 17 '15 at 20:43

### 4 ops = 1.9934200404 points:

$1+2+34 \div \sqrt{56789} = 3.1426746469\dots$

Off by 0.00108199.

### 5 ops = 2.2864604146 points:

$\sqrt{12}-34\cdot \sqrt{56} \div 789 = 3.1416267073\dots$

Off by 0.0000340537.

# 6 ops = 2.7136051067 points:

$(1+(23+4+5)\div 678)\cdot\sqrt 9 = \frac{355}{113} = 3.14159292035 \dots$

Off by only 0.000000266764(!)

Now we can keep taking square roots of 1 in this expression to get a lower score bound for $n$ operations where $n \geq 6$, namely: $$s_n = -\ln \left( \frac{ 355/113 } \pi - 1 \right) / n$$

Which yields the results:

 7 ops = 2.3259472344 points
8 ops = 2.0352038301 points
9 ops = 1.8090700712 points
10 ops = 1.6281630641 points


Oh, and to demonstrate the restrictions in the OP -- if complex logarithms were allowed, I could write $$\ln(-1) \div \sqrt{\lfloor -2/3456789 \rfloor} = i\pi/i = \pi.$$

EDIT: for 7 ops, I found

$$\sqrt{\sqrt{123-\sqrt{4!+5678/9}}}=3.14159355670578 \dots$$

scoring 2.1517349612 points, beating Ben Frankel's score.

• Very impressive, but isn't that actually closer to -200743.9379? – r3mainer Apr 17 '15 at 21:08
• Err, I had a little typo there. Should be right now. – Lynn Apr 17 '15 at 21:15
• Ah yes, that's better :-D – r3mainer Apr 17 '15 at 21:18
• You're missing a zero in your "off by" number. It should be 0.000034... – GentlePurpleRain Apr 17 '15 at 21:25
• I found a smaller error using 9 operations, thus passing your lower bound from 9 and on. I can use $n = |n|$ wherever to add operations. – Ben Frankel Apr 18 '15 at 22:11

I wrote a program that approximates an inputted value using inputted digits by checking increasingly complex expressions. These are the best results so far:

## 10: Score - 1.82589426:

$\sqrt{\sqrt{12\cdot\frac{\sqrt{34}-\sqrt{5}}{6}-7}+\sqrt{89}} \approx 3.141592691$

Accurate to 8 digits.

## 9: Score - 2.06300955:

$\sqrt{1+\sqrt{\sqrt{2}\cdot\frac{3}{45-\sqrt{6}}\cdot789}} \approx 3.141592626$

Accurate to 8 digits.

## 8: Score - 2.13531697:

$\sqrt{1+\frac{\sqrt{23}-\sqrt{4\cdot56}}{78}+9} \approx 3.141592773$

Accurate to 7 digits.

## 7: Score - 2.06840056:

$\sqrt{123\frac{\sqrt{\sqrt{4}+56-7}}{89}} \approx 3.1415943$

Accurate to 6 digits.

## 6: Score - 2.14803568:

$123\times(\sqrt{4}+\sqrt{5/67})/89 \approx 3.141585$

Accurate to 5 digits.

## 5: Score - 2.28646041:

$\sqrt{12}-34\cdot\frac{\sqrt{56}}{789} \approx 3.141627$

Accurate to 4 digits. (Mauris reached this first)

## 4: Score - 2.25419741:

$\sqrt{\frac{1234}{56+78-9}} \approx 3.141974$

Accurate to 4 digits.

## 3: Score - 1.50120325:

$\frac{1234}{567}-8+9 \approx 3.176367$

Accurate to 2 digits.

## 2: Score - 1.27256827:

$\frac{1}{2345}\cdot6789 \approx 2.895096$

Error of ~0.25. (pacoverflow reached this first)

## 1: Score - 0.86466930:

$\frac{12345}{6789} \approx 1.818383$

Error of ~1.3. (pacoverflow reached this first)

• Your calculation seems to be backwards, in terms of score. The score is 0.651964286 (which is the inverse of the number you gave). I think your computer code might have had a bug in it. – Glen O Apr 18 '15 at 10:26
• @GlenO, are you sure? I've tried a few times to recalculate the score of 3.17 with 3 ops but I get the same result. EDIT: Also if pacoverflow is off by 0.16 with 3 ops and he gets ~0.9 score then I am off by 0.035 so I shouldn't get ~0.65 score. – Ben Frankel Apr 18 '15 at 10:32
• Oops, just noticed I used "log" on my PC's calculator, assuming it would be ln. It's log_10. So you're right. Sorry about that. – Glen O Apr 18 '15 at 10:37
• +1, I was wondering if there was anything better for n=1,2,3. – pacoverflow Apr 18 '15 at 16:51

## Score = 2,176,716,257 (That's not a typo)

I think you want to fix your scoring formula.

Here's my attempt:

123456789!

And here's the proof of my score:

Thank you, Wolfram Alpha
In the screenshot, note that $log$ denotes the natural log as explained on the right. If you don't fix the formula, you run into a problem with infinite scores because...

Adding factorials makes $n_{ops}$ grow linearly but $A$ grow at a much faster rate.
My next guesses would all yield higher scores:
(123456789!)!
((123456789!)!)!
(((123456789!)!)!)!

This one isn't in order, but I can't resist offering it up anyway:

$\dfrac{\ln((8\times5!)^3+(2\times\sqrt{9})!+4!)}{\sqrt{7\times6+1}}$

14 ops, but off by just $4\times 10^{-14}$! The catch here is:

43 (which shows up in the denominator) is a so-called Heegner Number, so $e^{\pi\sqrt{43}}$ is very close to an integer - specifically, to $960^3+744$.

## Score = 1.187987428

Here's my first effort, off by 0.00827 with 5 operators:

$$\sqrt{\sqrt{(1234 \times 56\ /\ 78)\ /\ 9}} = 3.14986$$

I figured I'd have a go at it myself. Here's an approximation I found:

$\sqrt{\sqrt{123+4-5\times6+\frac7{8+9}}} \approx 3.14161421087308 \approx \pi+0.000021557$

with 8 operations. Score = 1.486190839099123

UPDATE: here's a new one:

$\sqrt{\sqrt{\frac12+\frac{3!+4}{5+6}+7+89}}\approx 3.141592652582646 \approx \pi - 0.000000001007147$

with 10 operations. Score = 2.186087400111085. This one is based on an expression given by Ramanujan, $\pi\approx\sqrt{\frac{2143}{22}}$.

• That 10 operation one is extremely cool! – Lynn Apr 19 '15 at 16:43
• Also, regarding Ramanujan's approximation, it can also be written like this: $$\large\pi\approx \sqrt{\sqrt{3^4+\frac{19^2}{78-56}}}$$ which uses all the digits from $1$ to $9$ too (but not in order). That is a special approximation :D – Mr Pie Sep 9 '18 at 9:02

Attempt with 4 operators: (Score = 0.978898573)

$$\sqrt{\sqrt{\sqrt{\sqrt{123456789}}}} = 3.20420$$ (off by 0.06261)

Attempt with 3 operators: (Score = 0.991181027)

(1+2345+6)/789 = 2.98098 (off by 0.16060)

Attempt with 2 operators: (Score = 1.272568270)

(1/2345)*6789 = 2.89509 (off by 0.24649)

Attempt with 1 operator: (Score = 0.864669301)

12345/6789 = 1.81838 (off by 1.32320)

I believe this is the highest score possible with 100 or fewer operations:

## 99 operations; Score > $$10^{10^{10^{10^{10^{10^{10^{10^{10^{10^{10}}}}}}}}}}$$

$$\left(\left[1 - \left(2\times\log\left\lceil\sqrt{3!!!!!!!!!!!!!}\right\rceil -\sqrt{4}\right)\div\left(\left\lfloor\sqrt{\left\lceil\sqrt{5}\right\rceil !!!!!!!!!!!!!}\right\rfloor!\right)\right]^{\left\lceil\sqrt{6!!!!!!!!!!!!}\right\rceil !} \div\left\lfloor\sqrt{7}\right\rfloor\right)\times\left\lceil\sqrt{\left\lceil\sqrt{8}\right\rceil !!!!!!!!!!!!!}\right\rceil!\times\left\lfloor\sqrt{(\sqrt{9}) !!!!!!!!!!!!!}\right\rfloor!\approx \pi + \frac{1}{2\sqrt{3!!!!!!!!!!!!!}}$$ Those long strings of factorials represent iterated factorials, not double factorials or anything weird like that.

As the rather absurd score above suggests, arbitrarily large scores are possible. In particular, we can construct a sequence of approximations $$A_k$$ that converge extremely rapidly to $$\pi$$, giving scores that go diverge rapidly infinity. (See Rex Eupseiphos's answer for the first few terms of the sequence to see how fast it approximates $$\pi$$).

Let $$x!_k$$ represent $$k$$ iterations of the factorial, e.g. $$3!_2 = (3!)!=6!= 720$$. According to the rules of the puzzle, using $$!_k$$ requires $$k$$ operations. Then we have $$\pi \approx A_k =\left(\left[1 - \left(2\times\log\left\lceil\sqrt{3!_k}\right\rceil -\sqrt{4}\right)\div\left(\left\lfloor\sqrt{\left\lceil\sqrt{5}\right\rceil !_k}\right\rfloor!\right)\right]^{\left\lceil\sqrt{6!_{k-1}}\right\rceil !} \div\left\lfloor\sqrt{7}\right\rfloor\right)\times\left\lceil\sqrt{\left\lceil\sqrt{8}\right\rceil!_k}\right\rceil!\times\left\lfloor\sqrt{(\sqrt{9})!_k}\right\rfloor!$$ has $$n_{ops} = 34 + 5k$$. The score of $$A_k$$ goes to infinity as $$k$$ goes to infinity. We have bounds $$\pi < A_k < \pi\cdot\exp\left(\frac1{6\cdot\left\lceil\sqrt{3!_k}\right\rceil}\right)$$ which implies that the score of $$A_k$$ is bounded below by $$\mathrm{score}(A_k) = -\frac{\ln\left(\frac{A}{\pi} -1\right)}{34+5k} > \frac{\log\left(3\cdot\left\lceil\sqrt{3!_k}\right\rceil\right)}{34+5k}$$

Explanation and proof:

Stirling's approximation tells us that $$\pi = \lim_{n\rightarrow\infty} \frac{n!^2}{2 n \left(\frac{n}{e}\right)^{2n}}$$ This is the main principle used. To prove the bounds of $$A_k$$ claimed above, we use some easy asymptotic bounds. For $$\frac{x}{m} > -1$$: $$\left(1 + \frac{x}{m}\right)^m = \exp\left(m\log\left(1 + \frac{x}{m}\right)\right) < \exp\left(m\cdot\frac{x}{m}\right) = \exp(x)$$ Slightly more difficult is a lower bound on $$\left(1 + \frac{x}{m}\right)^m$$, but using the fact that $$\log(z) > z-1 - (z-1)^2$$ for $$1>z > 0.3$$ (see WolframAlpha) we can see that $$\left(1+\frac{x}{m}\right)^m > \exp\left(x - \frac{x^2}{m}\right)$$ Furthermore, we use the refinement of Stirling's approximation: $$\pi\cdot\exp\left(\frac2{12n+1}\right)<\frac{n!^2}{2n\left(\frac{n}{e}\right)^{2n}} < \pi\cdot\exp\left(\frac1{6n}\right)$$ This is all we need. Let $$u_k = \left\lceil\sqrt{3!_k}\right\rceil$$. Since $$n!$$ is never a perfect square for $$n>1$$ (this follow's from Bertrand's Postulate), we also have $$\left\lfloor\sqrt{3!_k}\right\rfloor = u_k-1$$. This allows us to simplify $$A_k$$: $$\begin{eqnarray}A_k &=&\left(\left[1 - \left(2\times\log\left\lceil\sqrt{3!_k}\right\rceil -\sqrt{4}\right)\div\left(\left\lfloor\sqrt{\left\lceil\sqrt{5}\right\rceil !_k}\right\rfloor!\right)\right]^{\left\lceil\sqrt{6!_{k-1}}\right\rceil !} \div\left\lfloor\sqrt{7}\right\rfloor\right)\times\left\lceil\sqrt{\left\lceil\sqrt{8}\right\rceil!_k}\right\rceil!\times\left\lfloor\sqrt{(\sqrt{9})!_k}\right\rfloor!\\&=&\frac{\left[1 - \frac{2\times\log\left\lceil\sqrt{3!_k}\right\rceil -\sqrt{4}}{\left\lfloor\sqrt{\left\lceil\sqrt{5}\right\rceil !_k}\right\rfloor!}\right]^{\left\lceil\sqrt{6!_{k-1}}\right\rceil !} \times\left\lceil\sqrt{\left\lceil\sqrt{8}\right\rceil!_k}\right\rceil!\times\left\lfloor\sqrt{(\sqrt{9})!_k}\right\rfloor!}{\left\lfloor\sqrt{7}\right\rfloor}\\&=&\frac{\left[1 - \frac{2\times\log\left\lceil\sqrt{3!_k}\right\rceil - 2}{\left\lfloor\sqrt{3 !_k}\right\rfloor!}\right]^{\left\lceil\sqrt{(3!)!_{k-1}}\right\rceil !} \times\left\lceil\sqrt{3!_k}\right\rceil!\times\left\lfloor\sqrt{3!_k}\right\rfloor!}{2}\\&=&\frac{\left[1 - \frac{2\log u_k - 2}{(u_k - 1)!}\right]^{u_k !} u_k!(u_k - 1)!}{2}\\&=&\frac{\left[1 + \frac{2u_k(1 - \log u_k)}{u_k!}\right]^{u_k !} u_k!^2}{2u_k}\end{eqnarray}$$ This final formula allows us to get an upper bound for $$A_k$$, assuming $$2u_k(1 - \log u_k) > - u_k!$$, which is true for all $$k\ge0$$.: $$\begin{eqnarray}A_k &=& \frac{\left(1 + \frac{2u_k(1 - \log u_k)}{u_k!}\right)^{u_k !} u_k!^2}{2u_k} < \frac{\exp(2u_k(1 - \log u_k)) u_k!^2}{2u_k}\\&=&\frac{u_k^2}{2u_k\left(\frac{u_k}{e}\right)^{2u_k}}<\pi\cdot\exp\left(\frac{1}{6 u_k}\right)\end{eqnarray}$$ To find a lower bound, because $$1>1+\frac{2u_k(1 - \log u_k)}{u_k!} > 0.3$$ for all $$k\ge 1$$, we have $$\begin{eqnarray}A_k &=& \frac{\left(1 + \frac{2u_k(1 - \log u_k)}{u_k!}\right)^{u_k !} u_k!^2}{2u_k} \\&>& \exp\left(-\frac{(2u_k(1 - \log u_k))^2}{u_k!}\right) \frac{u_k^2}{2u_k\left(\frac{u_k}{e}\right)^{2u_k}}\\&>&\pi\cdot\exp\left(-\frac{(2u_k(1 - \log u_k))^2}{u_k!}\right)\exp\left(\frac{2}{12 u_k + 1}\right)\\&=&\pi\cdot\exp\left(\frac{2}{12 u_k + 1} - \frac{(2u_k(1 - \log u_k))^2}{u_k!}\right)\end{eqnarray}$$ The part inside the exponential is positive for all $$k \ge 2$$. Computationally, $$A_k$$ can be seen to be larger than $$\pi$$ for $$k=0,1$$, so we have the desired bounds for all $$k$$: $$\pi < A_k < \pi\cdot\exp\left(\frac1{6\cdot\left\lceil\sqrt{3!_k}\right\rceil}\right)$$ For $$k \ge 2$$, we have the more precise lower bound $$A_k > \pi\cdot\exp\left(\frac{2}{12 u_k + 1} - \frac{(2u_k(1 - \log u_k))^2}{u_k!}\right)$$

Calculation of the score:

The answer at the top is $$A_{13}$$, which will be off by about $$\frac{1}{\sqrt{3!_{13}}}$$ and has $$34 + 5\cdot 13 = 99$$ operations. From the above calculation of score, we know that its score is at least $$\frac{1}{99}\log\left(3\cdot\sqrt{3!_{13}}\right) > 3!_{12}$$ Since $$x! > 10^x$$ for $$x>24$$, and $$(3!)! = 720 > 24$$, we can conclude that a power tower of $$11$$ tens is a lower bound for the score. WolframAlpha gives this approximation for $$3!_{12}$$: $$10^{10^{10^{10^{10^{10^{10^{10^{10^{10^{1749.66}}}}}}}}}}$$

Slightly simplifying Dark Malthorp's remarkable solution, we get: $$\pi \approx A_k = \left[1 - \left( 2 \cdot \log\lceil \sqrt{3!_k}\rceil + \sqrt{4}\right)\div(\lfloor\sqrt{\lceil\sqrt 5\rceil!_k}\rfloor!)\right]^{\lceil\sqrt{6!_{k-1}}\rceil!} \div \lfloor\sqrt 7\rfloor \cdot \lceil\sqrt{\lceil\sqrt 8\rceil!_k} \rceil!\cdot \lfloor\sqrt{\sqrt{9}!_k}\rfloor!$$ which has $$34+5k$$ operations. Also, the approximation is bounded by $$\pi < A_k < \pi\cdot(1+1/6\sqrt{3!_k})$$, which is an astoundingly close approximation to $$\pi$$ when $$k \geq 3$$.

For convenience for reading and for calculating (with small k), the formula for can be simplified to: $$A = \frac{\left[1 - \frac{2\left(\log{n} - 1)\right)}{(n-1)!} \right]^{n!}}{2} n! (n-1)!$$ where $$n = \lceil\sqrt{3!_k}\rceil$$

39 operations ($$k = 1$$):
We have $$n = 3$$, and $$A = \left[1 - \left( 2 \cdot \log\lceil \sqrt{3!}\rceil + \sqrt{4}\right)\div(\lfloor\sqrt{\lceil\sqrt 5\rceil!}\rfloor!)\right]^{\lceil\sqrt{6}\rceil!} \div \lfloor\sqrt 7\rfloor \cdot \lceil\sqrt{\lceil\sqrt 8\rceil!} \rceil!\cdot \lfloor\sqrt{\sqrt{9}!}\rfloor! = 3.21826$$ for a score of 0.0952...not particularly impressive. However, it does validate the bounds on the estimate: $$\pi < A_1 = 3.21826 < 3.355 = \pi\cdot\left(1+\frac{1}{6\sqrt 3!}\right)$$

44 operations ($$k = 2$$):
We have $$n = \lceil\sqrt{3!!}\rceil = 27$$. The calculation gets much more difficult than with $$k=1$$, but it's still tractable. I did it using MPFR (Multiple Precision Floating-Point Reliably) in R:

1 - (2*log(mpfr(27,200))-2)/factorial(mpfr(26,200)))^factorial(mpfr(27,200))*
factorial(mpfr(27, 200)) * factorial(mpfr(26, 200))/2


which gives $$A = \left[1 - \left( 2 \cdot \log\lceil \sqrt{3!!}\rceil + \sqrt{4}\right)\div(\lfloor\sqrt{\lceil\sqrt 5\rceil!!}\rfloor!)\right]^{\lceil\sqrt{6!}\rceil!}\div \lfloor\sqrt 7\rfloor \cdot \lceil\sqrt{\lceil\sqrt 8\rceil!!} \rceil!\cdot \lfloor\sqrt{\sqrt{9}!!}\rfloor! = 3.16104$$ for a score of 0.1156...still not very impressive, but provides another validation of the bounds: $$\pi < A_2 = 3.16104 < 3.16111 = \pi\cdot\left(1+\frac{1}{6\sqrt{3!!}}\right)$$

49 operations ($$k = 3$$): With $$k=3$$, the direct calculations become intractable because $$n = \lceil\sqrt{3!!!}\rceil \approx 1.61\times 10^{873}$$, which we'd need to take the factorial of and then put it in the exponent--not going to happen. However, Dark Malthorp's proof gives valid bounds on the approximation that are not impossible to calculate for $$k=3$$: $$\pi < A_3 < \pi\cdot\left(1+\frac{1}{6\sqrt{3!!!}}\right)$$ which gives $$\pi < A = \left[1 - \left( 2 \cdot \log\lceil \sqrt{3!!!}\rceil + \sqrt{4}\right)\div(\lfloor\sqrt{\lceil\sqrt 5\rceil!!!}\rfloor!)\right]^{\lceil\sqrt{6!!}\rceil!} \div \lfloor\sqrt 7\rfloor \cdot \lceil\sqrt{\lceil\sqrt 8\rceil!!!} \rceil!\cdot \lfloor\sqrt{\sqrt{9}!!!}\rfloor! = 3.1415926535897932384...\approx \pi + 10^{-873}$$ accurate to nearly 1000 digits. This gives a score of around 41.07.

Not sure if decimal are allowed, but here's my attempt

1 operator, score 1.1765956249508713525610395676804...

$$123.4/56.789 \approx 2.17295603 \approx \pi - 0.96863662$$

3 operator, score 2.06714352383430453303221463889...

$$(1234/56)/(\lfloor7.89\rfloor) \approx 3.14795918 \approx \pi + 0.00636653$$

SCORE: 1.116831135 (7 Ops)

(1-2) * (34-56) / 7 * (-8 + 9) = 22/7

SCORE: 0.977227243 (8 Ops)

((1+2) * 3)/4/(5+6)/7/8/9 = 22/7

SCORE: 1.5636 (5 Ops) Thanks @Glen O.

(⌊1234/56⌋/7)*(-8+9) = 22/7

• I figured I'd give you a nudge towards a further improvement. $\lfloor 1234/56\rfloor = 22$. (for that matter, it's not far from being 22, so you might be able to drop the floor operation and get an even better score) – Glen O Apr 18 '15 at 8:37
• Also, you've used log_10 rather than ln in your score calculation. Your scores should be 0.977227108 for 8 ops and 1.116830981 for 7 ops. – Glen O Apr 18 '15 at 12:18
• @Glen O: ln|1−A/π| = -7.818. So the calculation is correct.Right? I used the example in the problem. Also do update my name in the top 10 answers :) – thepace Apr 19 '15 at 12:15
• That is the correct logarithm. And then you negate it and divide it by the number of operations, giving 1.116831135 for the 7 ops case and 0.977227243 for the 8 ops case. The scores you listed in your answer are the values you get if you use log_10 rather than ln. – Glen O Apr 19 '15 at 13:36
• And I'm not sure what you mean about the top 10 answers. Perhaps you didn't notice, but it's not a top 10 - it's best answer for each number of operations. The only answer your score beats is the 1 op answer, which obviously your answers aren't (1 op answers, that is). – Glen O Apr 19 '15 at 13:38

With the incorrect scoring method:

((((12!^3!^4!^5!^6!^7!^8!^9!)!)!)!)!...... resulting in a pi that far..far away but gives the highest of scores!

Second Attempt: 10 operators (Score = 0.524352512)

1/(2^3) + |-4+5-6+7-8+9| = 3.125 (off by 0.01659)

First attempt: 4 operators (Score = 0.665238338)

(1/2)+3-(456/789) = 2.92205 (off by 0.21953)

• Your second attempt uses exponentiation, which costs 3 operations. So it's actually 12 operations, not 10. – Glen O Apr 18 '15 at 9:26
• Following on from my previous comment, you can actually reduce it back to 11 operations by using $2+3!$ (for two operations) instead of 2^3. – Glen O Apr 19 '15 at 3:41

# 1 operation score 2.2538864...

12 / 3.456789 ≈ π + 0.329837026

• The decimal point is not a valid operation, and would have to count as one. – boboquack Feb 10 '18 at 23:40
• @boboquack There is no such claim on the question. The question does not forbid non natural numbers. – Bruno Costa Feb 10 '18 at 23:47
• "Your job is to approximate π using the sequence of digits (in order): 1 2 3 4 5 6 7 8 9 with operators inserted between them (permitted operators listed below)." Since the decimal point is between two of your digits, it must be an operator, as that is the only thing you are allowed to do to the digits. However, it is not listed as one of the permitted operators, therefore it must be forbidden. – boboquack Feb 11 '18 at 0:08
• What I am arguing is that the number1.234 has the digits 1 to 4 in sequence and doesn't have any operator. There is no operator between number 1 and 2 since 1 and 2 are part of the same number. – Bruno Costa Feb 11 '18 at 0:18
• @BrunoCosta - You have the numbers 1 through 9 in order. You can insert any of the permitted operators between them. It says nothing about you being allowed to insert non-operators, and since it specifically tells you what you are allowed to do, the conclusion is naturally that you can't add decimal places (as it is not one of the permitted operators). wuiyang expressed uncertainty as to whether their answers are valid, and led to me asking for opinions on whether they should be permitted (as they aren't, right now). Since nobody gave a reason to permit them, they remain rejected. – Glen O Feb 17 '18 at 4:39

1st ops:

$1+2-3-4+5-6+7+\sqrt{\sqrt{\sqrt{\sqrt{8+9}}}} = 3.1937216143839002$

• Fixed square root symbols for you, but why is this labeled "1st ops"? There are 12 operations here, and you didn't include your score. – Rubio Feb 11 '18 at 19:33

### 14 Operations - score 0.16088866261

$$\sqrt((6!)/(8\times5))-(\sqrt(\sqrt(34)-\sqrt(21)))+\ln(\sqrt((9-7)))\approx3.47190671012$$

• I'm not one of the downvoters, but I think you've neglected an important rule of the question that is present in all other answers: the numbers 1 though 9 should be used in that order. In your answer it's 6,8,5,3,4,2,1,9,7 instead of 1,2,3,4,5,6,7,8,9.. – Kevin Cruijssen Jun 8 '16 at 13:11