79
$\begingroup$

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.

Note: There must be at least 1 operation in your answer!

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.

Operations Score User
1 0.864669301 pacoverflow
2 1.272568270 pacoverflow
3 1.501203245 Ben Frankel
4 2.254197410 Ben Frankel
5 2.286460415 Lynn
6 2.713605107 Lynn
7 2.151734961 Lynn
8 2.135316968 Ben Frankel
9 2.063009554 Ben Frankel
10 2.186087400 Glen O

Let me know if I've missed one.

$\endgroup$
29
  • 12
    $\begingroup$ 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$ $\endgroup$ Commented Apr 17, 2015 at 16:58
  • 2
    $\begingroup$ @RossMillikan I think I can top that with A = 12^3^4^5^6^7^8^9 ;-) $\endgroup$
    – Mark N
    Commented Apr 17, 2015 at 18:00
  • 8
    $\begingroup$ 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. $\endgroup$
    – lynn
    Commented Apr 17, 2015 at 19:28
  • 2
    $\begingroup$ @MarkN: Yes, I thought about that. I tried $12^{3^{456789}}$ but couldn't evaluate the score. $\endgroup$ Commented Apr 17, 2015 at 20:43
  • 4
    $\begingroup$ I’m voting to close this question because open-ended puzzles are off-topic as of May 2019 $\endgroup$
    – bobble
    Commented Aug 5, 2021 at 3:56

15 Answers 15

60
$\begingroup$

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.

$\endgroup$
12
  • 2
    $\begingroup$ Very impressive, but isn't that actually closer to -200743.9379? $\endgroup$
    – r3mainer
    Commented Apr 17, 2015 at 21:08
  • 2
    $\begingroup$ Err, I had a little typo there. Should be right now. $\endgroup$
    – lynn
    Commented Apr 17, 2015 at 21:15
  • 2
    $\begingroup$ Ah yes, that's better :-D $\endgroup$
    – r3mainer
    Commented Apr 17, 2015 at 21:18
  • 2
    $\begingroup$ You're missing a zero in your "off by" number. It should be 0.000034... $\endgroup$ Commented Apr 17, 2015 at 21:25
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Apr 18, 2015 at 22:11
22
$\begingroup$

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)

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – Glen O
    Commented Apr 18, 2015 at 10:26
  • $\begingroup$ @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. $\endgroup$ Commented Apr 18, 2015 at 10:32
  • $\begingroup$ 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. $\endgroup$
    – Glen O
    Commented Apr 18, 2015 at 10:37
  • $\begingroup$ +1, I was wondering if there was anything better for n=1,2,3. $\endgroup$ Commented Apr 18, 2015 at 16:51
18
$\begingroup$

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$.

$\endgroup$
18
$\begingroup$

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.
Screenshot

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!)!)!)!

$\endgroup$
3
  • 1
    $\begingroup$ Probably just adding a condition like $0 < A <2\pi$ would be sufficient, since the goal is supposed to be approximating $\pi$. $\endgroup$ Commented Apr 17, 2015 at 20:53
  • 11
    $\begingroup$ No, like I said before, there's no reason to take the absolute value of the log, you just need to negate it. $\endgroup$
    – lynn
    Commented Apr 17, 2015 at 21:19
  • 1
    $\begingroup$ Even with the corrected scoring function, arbitrarily large scores are possible. The rules are very flexible! $\endgroup$
    – user63779
    Commented Feb 14, 2020 at 18:28
15
$\begingroup$

Score = 1.187987428

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

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

$\endgroup$
14
$\begingroup$

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[4]{\frac{2143}{22}}$.

$\endgroup$
2
  • 1
    $\begingroup$ That 10 operation one is extremely cool! $\endgroup$
    – lynn
    Commented Apr 19, 2015 at 16:43
  • $\begingroup$ 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 $\endgroup$
    – Mr Pie
    Commented Sep 9, 2018 at 9:02
14
$\begingroup$

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}}}}}}}}}} $$

$\endgroup$
12
$\begingroup$

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)

$\endgroup$
0
6
$\begingroup$

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.

$\endgroup$
3
$\begingroup$

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 $$

$\endgroup$
0
2
$\begingroup$

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

$\endgroup$
7
  • $\begingroup$ 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) $\endgroup$
    – Glen O
    Commented Apr 18, 2015 at 8:37
  • $\begingroup$ 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. $\endgroup$
    – Glen O
    Commented Apr 18, 2015 at 12:18
  • $\begingroup$ @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 :) $\endgroup$
    – thepace
    Commented Apr 19, 2015 at 12:15
  • $\begingroup$ 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. $\endgroup$
    – Glen O
    Commented Apr 19, 2015 at 13:36
  • $\begingroup$ 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). $\endgroup$
    – Glen O
    Commented Apr 19, 2015 at 13:38
1
$\begingroup$

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)

$\endgroup$
2
  • $\begingroup$ Your second attempt uses exponentiation, which costs 3 operations. So it's actually 12 operations, not 10. $\endgroup$
    – Glen O
    Commented Apr 18, 2015 at 9:26
  • $\begingroup$ 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. $\endgroup$
    – Glen O
    Commented Apr 19, 2015 at 3:41
0
$\begingroup$

1st ops:

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

$\endgroup$
1
  • 4
    $\begingroup$ 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. $\endgroup$
    – Rubio
    Commented Feb 11, 2018 at 19:33
0
$\begingroup$

(1/2)!³⁺⁴⁻⁵(-6-7+8+9)= π

which I think would give a score of infinity.

$\endgroup$
3
  • 1
    $\begingroup$ Unfortunately, the question states that you can only apply factorial to natural numbers, so your answer is invalid. Clever idea though! $\endgroup$
    – HTM
    Commented Mar 6, 2021 at 2:28
  • $\begingroup$ Oh, well thanks for pointing that out. $\endgroup$ Commented Mar 6, 2021 at 4:06
  • $\begingroup$ Indeed, the restriction on factorial was put in place specifically because of (1/2)! being reasonably interpreted as gamma(3/2). $\endgroup$
    – Glen O
    Commented Mar 7, 2021 at 6:54
-4
$\begingroup$

 14 Operations - score 0.16088866261

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

$\endgroup$
1
  • 10
    $\begingroup$ 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.. $\endgroup$ Commented Jun 8, 2016 at 13:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.