What's the closest approximation to $\pi$ using the digits $0-9$ only once?

2.9k Views Asked by At

What's the closest approximation to $\pi$ achievable using each digit $0-9$ no more than once, and basic operations of roots, brackets, exponentiation, addition subtraction, concatenation, division and factorial?

This was mentioned in another question and I thought it was fun. I can pretty quickly come up with (with a bit of help from Ramanujan):

$$\frac{7}{3}\left(1+\sqrt{\frac{6}{50}}\right)-\frac{8}{2\times4\times9!}\approx3.1415958$$

I challenge anybody to get beyond 20 decimal digits of accuracy!

9

There are 9 best solutions below

4
On BEST ANSWER

We will use notation $\sqrt{^{n}\;x}\quad$ for $n$ nested square roots (see tehtmi's answer): $$\sqrt{^{n}\;x} = \underbrace{\sqrt{\sqrt{\cdots \sqrt{\sqrt{x}}}}}_{n} = \sqrt[2^n]{x}.$$

Here is one example:

this formula is pandigital one; it uses all mentioned operations excluding exponentiation. $$ \sqrt{\dfrac{8}{\sqrt{^2\;9}}} + \sqrt{\vphantom{\dfrac{8}{8}}^{8}\; \dfrac{\sqrt{^9\; \sqrt{6!} + \sqrt{^{11}\; \left( \sqrt{^8\;4} + \dfrac{1}{\sqrt{^{16}\;2}} + \sqrt{^9 \left(\sqrt{^7\;5!} - \sqrt{^{16}(3!-0!)}\right) } \right) }}}{7} } \\ \approx 3.14159\;26535\;89793\;23846\;26\color{Tan}{610} \approx \pi + 1.766\times 10^{-23}; \tag{P.1}$$

By steps:


$a = \sqrt{^7 \; 5!} - \sqrt{^{16}\;(3!-0!)} \approx 0.03808 59887 98727 14645 $;


$b = \sqrt{^8 \; 4} + \dfrac{1}{\sqrt{^{16}\;2}} + \sqrt{^9\; a} \approx 2.99905 70159 26621 87896$;


$c = \sqrt{6!} + \sqrt{^{11}\;b}\approx 27.83335 21520 97348 95023$;


$d = \dfrac{\sqrt{^9\;c}}{7}\approx 0.14378 82430 20488 46604$;


$\pi \approx \sqrt{\dfrac{8}{\sqrt{^2\;9}}} + \sqrt{^8\; d}$.

Simplified WolframAlpha checking code:

sqrt(8/sqrt(3)) + ( ( sqrt(6!) + (4^(1/256) + 2^(-1/65536) + ( (5!)^(1/128) - 5^(1/65536) )^(1/512) )^(1/2048) )^(1/512) /7 )^(1/256) - pi


How it can be obtained:

Note that when we will use one digit, we can approximate number $\pi$ to $2$ decimal digits: $$ \sqrt{^{15} \; (7!)!} \approx 3.1\color{Tan}{822} \approx \pi + 4.067 \times 10^{-2}; \tag{1} $$

$2$ used digits: $4$ decimal digits of accuracy: $$ \sqrt{\sqrt{5!} - \sqrt{^7\;7!}} \approx 3.141\color{Tan}{349} \approx \pi - 2.435\times 10^{-4}; \tag{2} $$

$3$ used digits: $7$ (and maybe more) decimal digits of accuracy: $$ 2 + \sqrt{\vphantom{\dfrac{1}{1}}^{\:6} \; \dfrac{7!}{\sqrt{^8 \; 9!}}} \approx 3.14159\;2\color{Tan}{576} \approx \pi -7.676 \times 10^{-8}; \tag{3} $$

$4$ used digits: $11$ (and maybe more) decimal digits of accuracy: $$\sqrt{^{5} \; \sqrt{^8\;8!} - \sqrt{^{14}\;7!}} + \sqrt{6 - \sqrt{^{16}\; 3!}} \\ \approx 3.14159\;26535\color{Tan}{682} \approx \pi - 2.157 \times 10^{-11}; \tag{4} $$

$5$ used digits: $13$ (and maybe more) decimal digits of accuracy: $$ \sqrt{\dfrac{8}{\sqrt{^2\;9}}} + \sqrt{\vphantom{\dfrac{8}{8}}^{8}\; \dfrac{\sqrt{^9\; \sqrt{6!} + \sqrt{^{11}\;3}}}{7} } \\ \approx 3.14159\;26535\;89\color{Tan}{835} \approx \pi + 4.178\times 10^{-14}; \tag{5} $$

Now, replacing the digit "$3$" in $(5)$ by appropriate expression constructed of digits $0,1,2,3,4,5$, we get $(P.1)$ which approximates number $\pi$ with accuracy of $>20$ decimal places.


Approximation without $!$ and $\sqrt{\phantom{88}}$ : $$\Large 3 + \dfrac {9^{^{\frac{2}{5\cdot 7} - \left(1+6\right)^{-4}}}} {8} = 3+ \dfrac{9^{\frac{2}{35}-\frac{1}{2401}}}{8} \\ \approx \normalsize 3.1415926535 \color{Tan}{916} \approx \pi +1.875\times 10^{-12}.\tag{P.2}$$

(see Pi Estimation using Integers for more info).

Another approximation (without multiple square roots):

$$ \left(\sqrt{3!}-\sqrt{\sqrt{90-2}-6}\right) \times \sqrt{1+(4+5)\sqrt{8}} + 0\times 7 \\ = \left(\sqrt{6}-\sqrt{\sqrt{88}-6}\right) \times \sqrt{1+9\sqrt{8}} \\ \approx 3.1415926535897\color{Tan}{423} \approx \pi - 5.089\times 10^{-14}.\tag{P.3} $$ (see The Contest Center - Pi for similar examples).

Some approximations can be derived from Pi Approximations.

0
On

With 8 digits and with paper-and-pencil and Wolfram Alpha, I obtained:

$$\sqrt[8]{{7!}}+\frac {2}{9}+ \frac{5-4}{60} \approx 3.1416000$$

0
On

Very "bad" approximation with all digits and only three elementary operations:

$$3+\frac{1}{7}+\frac{2 \cdot 5}{809 \cdot (6+4)} \approx 3.1440$$

11
On

$\frac{\log (5280^{\sqrt{9}} + 3!! + 4! )}{1 \times \sqrt{67}} \approx 3.14159265358979324$, good for 18 places

If you don't like logs,
$(8\times9 +\frac{52-0!}{73})(\sqrt{-1}^{\sqrt{-4}}) \approx 3.14159266$, good for 8 places of accuracy.

$\sqrt{\sqrt{\frac{2143}{5!!+7}}} \approx 3.141592653$, good for 9 places of accuracy.

$3 \sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{20-\frac{4\times8}{9\times5 - 7 - 1}}}}}}} \approx 3.141592652$, good for 9 places of accuracy.

For $e$, I challenge people to beat Sabey's approximation of $(1+9^{-4^{7\times6}})^{3^{2^{85}}}$, which is only accurate to 18457734525360901453873570 decimal digits.

6
On

I can't prove this, but I think we may be able to get as close as we want by starting with $1234567890$, taking some number of factorials, and then taking square roots until we get a number less than $\pi^2$. Heuristically we get a random number in the interval $[\pi, \pi^2]$ whose logarithm is uniformly distributed so we ought to be able to get as close as we like to $\pi$ by taking enough factorials.

0
On

$$\frac{354 + (0!)^8}{\sqrt{12769}} = \frac{355}{113} \approx 3.1415929203$$ which is close to $\pi$ with an error absolute value of $2.6 \times 10^{-7}$.

This comes from one of the convergent approximations of the continued fraction expansion of $\pi$.

I am trying to find a slightly more accurate variation of this.

EDIT: This is a very liberal interpretation of the rules, but if we allow factorials of non-integers then we can obtain an exact formula for $\pi$, such as:

$$\pi = \left(\frac{3}{2}\right)!\times\left(\frac{6}{4}\right)!\times\frac{8}{9}\times(7-5)\times(1+0)$$

This uses the fact that $\left(\frac{3}{2}\right)! = \Gamma\left(\frac{5}{2}\right) = \frac{3\sqrt{\pi}}{4}$ (there's probably other nicer variations).

2
On

Cheating a little with decimal points, but very, very simple:

$3.8415926 - 0.7$

Also:

$3 + 1/7 - (6/((9480/2)+5)) \approx 3.1415926539214 \approx \pi + 3.316 \times 10^{-10} $

4
On

My answer uses lots of nested square roots, so I'll write $n$ nested square roots on $x$ as $\sqrt{^n x}$ to avoid writing them all out. Evaluated with Wolfram Alpha.

$$\sqrt{^5 70} - \sqrt{^{15} 9!} + \sqrt{^{23} 8!} + \sqrt{^{34} 14!} + \sqrt{^{36} .5} + \sqrt{^{41} 2} - \sqrt{^{46} .6} \approx \pi + 5.477.. \times10^{-16} $$

Here's something that should be equivalent that can be plugged into Wolfram Alpha: 70^(1/2^5) - 9!^(1/2^15) + 8!^(1/2^23) + 14!^(1/2^34) + (5/10)^(1/2^36) + 2^(1/2^41) - (6/10)^(1/2^46)

Basically, the fractional part of $\sqrt{^5 70}$ is a good approximation for the fractional part of $\pi$. Then the fractional part of $\sqrt{^{15} 9!}$ is a good approximation for the remaining fractional part error. And so on, with a bit of finesse to make the integer part work out nicely. Chaining a bunch of square roots on anything will always give something that helps at least a little, since you can get numbers arbitrarily close to $1$. I did a fairly simple greedy search.

Surely it is possible to do better with this approach, but I was about to the point where double precision floating point runs into trouble representing $(1 \pm \text{error})$ anyway.

0
On

Taking inspiration from @Dan Brumleve's answer, we could attempt to use nested square-roots, factorials and concatenations (i.e. floor and ceiling functions) to find integers whose ratio is arbitrarily close to $\pi$.

Various people have previously studied whether you can get every integer from nests of roots, factorials and concatenations, possibly only using the number $3$. Here are a few links to discussions on the topic:

I will be taking the floor of each square-root value, to make sure no factorials of non-integer arguments are taken. You don't have to do this, and you may find more numbers are possible when taking repeated square-roots. But you may need to be wary of only taking a factorial after a floor or ceiling function.

Define the string $3FSS\ldots$ to be the order of factorials ($F$) and floors of square-roots ($S$), read left to right. For example, $3FSFF$ would represent $\left(\left\lfloor\sqrt{3!}\right\rfloor!\right)!=2$. Also, for neatness' sake, let $S_n=\underbrace{S\ldots S}_n$

The following table shows some possible values with this method.

$$\begin{array}{|c|c|} \hline \text{number} & \text{generating string} & \text{algebra} \\ \hline 1 & 3S & \lfloor\sqrt{3}\rfloor \\ 2 & 3FS & \lfloor\sqrt{3!}\rfloor \\ 3 & 3 & 3 \\ 4 & 3FFSFS_4FS_5FS_7 & \ldots \\ 5 & 3FFSS & \left\lfloor\sqrt{\lfloor\sqrt{(3!)!}\rfloor}\right\rfloor \\ 6 & 3F & \lfloor\sqrt{3}\rfloor \\ \hline \end{array} $$

Hence, we can say that: $$\pi\approx\frac{3F_2S_2FSFS_2FS_4}{3F_2SFS_4FS_5FS_6FS_3}=\frac{1989}{633}=\color{red}{3.14}218\ldots$$

Therefore, we can get the first $3$ digits using only the number $3$. This could easily be extended to avoiding using $3$ twice, by replacing $3F$ with $6$.

We could further extend this technique by:

  • Nesting operations on the digits $4$ to $9$ too and combining the numbers in order to get a more efficient representation of $\pi$.
  • Combining the nests of operations with different digits (e.g. $\sqrt{3!+4!}$).
  • Proving whether all integers are reachable with this method, which would trivially prove that arbitrarily accurate approximations of $\pi$ are possible.

My very messy and un-pythonic python code used to generate the above formulae is provided here.