TransWikia.com

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

Puzzling Asked by Glen O on April 15, 2021

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{-lnleft|1-A/piright|}{n_{ops}} = frac{lnleft|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 $lnleft|1-A/piright|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.

15 Answers

4 ops = 1.9934200404 points:

Off by 0.00108199.

5 ops = 2.2864604146 points:

Off by 0.0000340537.

6 ops = 2.7136051067 points:

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} = ipi/i = pi.$$

EDIT: for 7 ops, I found

scoring 2.1517349612 points, beating Ben Frankel's score.

Correct answer by Lynn on April 15, 2021

With the incorrect scoring method:

Second Attempt: 10 operators (Score = 0.524352512)

First attempt: 4 operators (Score = 0.665238338)

Answered by Mark N on April 15, 2021

Attempt with 4 operators: (Score = 0.978898573)

Attempt with 3 operators: (Score = 0.991181027)

Attempt with 2 operators: (Score = 1.272568270)

Attempt with 1 operator: (Score = 0.864669301)

Answered by pacoverflow on April 15, 2021

Score = 1.187987428

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

Answered by r3mainer on April 15, 2021

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

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

Answered by Steven Stadnicki on April 15, 2021

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

I think you want to fix your scoring formula.

Here's my attempt:

And here's the proof of my score:

If you don't fix the formula, you run into a problem with infinite scores because...

Answered by Engineer Toast on April 15, 2021

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

with 8 operations. Score = 1.486190839099123

UPDATE: here's a new one:

with 10 operations. Score = 2.186087400111085. This one is based on an expression given by Ramanujan, $piapproxsqrt[4]{frac{2143}{22}}$.

Answered by Glen O on April 15, 2021

SCORE: 1.116831135 (7 Ops)

SCORE: 0.977227243 (8 Ops)

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

Answered by thepace on April 15, 2021

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{12cdotfrac{sqrt{34}-sqrt{5}}{6}-7}+sqrt{89}} approx 3.141592691$

Accurate to 8 digits.


9: Score - 2.06300955:

$sqrt{1+sqrt{sqrt{2}cdotfrac{3}{45-sqrt{6}}cdot789}} approx 3.141592626$

Accurate to 8 digits.


8: Score - 2.13531697:

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

Accurate to 7 digits.


7: Score - 2.06840056:

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

Accurate to 6 digits.


6: Score - 2.14803568:

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

Accurate to 5 digits.


5: Score - 2.28646041:

$sqrt{12}-34cdotfrac{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)

Answered by Ben Frankel on April 15, 2021

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

1 operator, score 1.1765956249508713525610395676804...

3 operator, score 2.06714352383430453303221463889...

Answered by wuiyang on April 15, 2021

 14 Operations - score 0.16088866261

Answered by SKr on April 15, 2021

1st ops:

Answered by Rohit-Pandey on April 15, 2021

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

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

Explanation and proof:

Calculation of the score:

Answered by Dark Malthorp on April 15, 2021

Slightly simplifying Dark Malthorp's remarkable solution, we get: $$pi approx A_k = left[1 - left( 2 cdot loglceil sqrt{3!_k}rceil + sqrt{4}right)div(lfloorsqrt{lceilsqrt 5rceil!_k}rfloor!)right]^{lceilsqrt{6!_{k-1}}rceil!} div lfloorsqrt 7rfloor cdot lceilsqrt{lceilsqrt 8rceil!_k} rceil!cdot lfloorsqrt{sqrt{9}!_k}rfloor!$$ which has $34+5k$ operations. Also, the approximation is bounded by $pi < A_k < picdot(1+1/6sqrt{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{2left(log{n} - 1)right)}{(n-1)!} right]^{n!}}{2} n! (n-1)!$$ where $n = lceilsqrt{3!_k}rceil$

39 operations ($k = 1$):
We have $n = 3$, and $$A = left[1 - left( 2 cdot loglceil sqrt{3!}rceil + sqrt{4}right)div(lfloorsqrt{lceilsqrt 5rceil!}rfloor!)right]^{lceilsqrt{6}rceil!} div lfloorsqrt 7rfloor cdot lceilsqrt{lceilsqrt 8rceil!} rceil!cdot lfloorsqrt{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 = picdotleft(1+frac{1}{6sqrt 3!}right)$$

44 operations ($k = 2$):
We have $n = lceilsqrt{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 loglceil sqrt{3!!}rceil + sqrt{4}right)div(lfloorsqrt{lceilsqrt 5rceil!!}rfloor!)right]^{lceilsqrt{6!}rceil!}div lfloorsqrt 7rfloor cdot lceilsqrt{lceilsqrt 8rceil!!} rceil!cdot lfloorsqrt{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 = picdotleft(1+frac{1}{6sqrt{3!!}}right)$$

49 operations ($k = 3$): With $k=3$, the direct calculations become intractable because $n = lceilsqrt{3!!!}rceil approx 1.61times 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 < picdotleft(1+frac{1}{6sqrt{3!!!}}right)$$ which gives $$pi < A = left[1 - left( 2 cdot loglceil sqrt{3!!!}rceil + sqrt{4}right)div(lfloorsqrt{lceilsqrt 5rceil!!!}rfloor!)right]^{lceilsqrt{6!!}rceil!} div lfloorsqrt 7rfloor cdot lceilsqrt{lceilsqrt 8rceil!!!} rceil!cdot lfloorsqrt{sqrt{9}!!!}rfloor! = 3.1415926535897932384...approx pi + 10^{-873}$$ accurate to nearly 1000 digits. This gives a score of around 41.07.

Answered by Rex Eupseiphos on April 15, 2021

which I think would give a score of infinity.

Answered by Daniel Magee on April 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP