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.