# A “better” rational approximation of pi?

$355/113$ is a good fractional approximation of $\pi$, because we use six digits to produce seven correct digits of $\pi$.
$$\frac{355}{113} = 3.1415929\ldots$$

Let $R$ be the ratio of the number of accurate digits produced to the number of digits used in the numerator and denominator, then
$$R\left(\frac{355}{113}\right) = \frac 7{3+3} = 1.166666\ldots\,{}$$ Can anyone find a "better" fraction such that $R > 1.16666\ldots\,{}$.

Added: Probably, a similar question would also make sense over a base other than $10$.

• This is tied up with the continued fraction expansion of $\pi$, but it's probably a better question for somewhere else. – Gerry Myerson Mar 22 '15 at 9:01
• The first 20-odd continued fraction expansions don't give anything better than 355/113 (see the OEIS, sequences A114526, A002485, A002486). – Marco Golla Mar 22 '15 at 9:07
• What you need is that $\pi$ is a typical real number in the Khinchin-Lévy sense (still an open conjecture though); this would directly imply that your sequence converges to $1$. – Emanuele Tron Mar 22 '15 at 9:53
• By "a typical number" I mean $$\lim_{n \rightarrow \infty} q_n^{1/n}=\lim_{n \rightarrow \infty} \left (\frac{p_n}{\pi}\right )^{1/n}=\mathrm{e}^{\pi^2/12 \log 2}$$ and $$-\lim_{n \rightarrow \infty}\frac 1 n \log_{10} \left | \pi-p_n/q_n\right |=\frac {\pi^2}{6 \log 2 \log 10}.$$ – Emanuele Tron Mar 22 '15 at 16:39
• There's no better number with a denominator under ten million (takes about two minutes to check on my machine). The second best (besides of course $710/226$) is a ratio of 1.0 achieved by $22/7$ and multiples of $335/113$ that have four-digit numerators and three-digit denominators, such as $1065/339$. After that, the next-best is 10/11 achieved by $103993/33102$. Note it is easy to do a linear search by just incrementing the denominator d and checking two numerators for each d: $ceiling(\pi d)$ and $floor(\pi d)$. Code (python): codepad.org/jLnyn9eU – usul Mar 23 '15 at 3:56

Using the idea of the other answer in a different way, if $u$ is the irrationality measure of $\pi$, then except for finitely many $p/q$, we have

$$\left| \pi - \frac{p}{q} \right| > \frac{1}{q^u}$$

and consequently

$$\frac{ -\log |\pi - (p/q)| }{\log p + \log q } < \frac{u}{2}$$

and there will be infinitely many fractions $p/q$ that come arbitrarily close to this bound. (and, of course, those finitely many exceptions which may exist that are allowed to exceed it) (and, whatever tiny excesses might arise due to the rounding error in the analysis)

If the irrationality measure if $\pi$ is greater than $2.34$, then there will be infinitely many fractions with a better value of $R$ than the one you found. (although that is not reason to expect any of them are small enough for us to actually find)

If $u < 2.3$, then there can only be finitely many fractions with a better value of $R$. But I have no idea how you would go about checking if any exist at all.

Almost all irrational numbers have irrationality measure $2$; for $\pi$ it's known that $u \leq 7.6063$

Expanding on my comment, here is a reason why you shouldn't find any better (in your sense) approximation.

Let $p_n/q_n$ be the $n$-th convergent of the continued fraction of $\pi$, and $R_n$ its quality as you defined it in your question.

We purposefully ignore integer parts and off-by-one errors in expressing the number of decimal digits and simply write $$R_n \doteq \frac{-\log_{10} \left | \pi-p_n/q_n\right |}{\log_{10} p_n+\log_{10} q_n} .$$

What we need now is that $\pi$ is a typical real number in the Khinchin-Lévy sense, which by the way holds for all real numbers but a set of measure $0$. This is an open conjecture, but the numerical evidence is very strong (check it for yourself if you wish).

This would mean, in particular, $$\lim_{n \rightarrow \infty} q_n^{1/n}=\lim_{n \rightarrow \infty} \left (\frac{p_n}{\pi}\right )^{1/n}=\mathrm{e}^{\pi^2/12 \log 2}$$ and $$-\lim_{n \rightarrow \infty} \frac 1 n \log_{10} \left | \pi-\frac{p_n}{q_n} \right |=\frac{\pi^2}{6 \log 2 \log 10}$$ (see here and here for the first equality, here, here and here for the latter).

A consequence of this would be $\lim_{n \rightarrow \infty} R_n=1$. This has of course nothing to do with base $10$ representation, Lévy's theorem answers your question in any base.

This is not a proof that $355/113$ is optimal, but you can check the first convergents with the code you were given in the comments; see also here and here for some effective results.

Just for the sake of completeness, mine was

a(n)={A=contfracpnqn(contfrac(Pi,n+1),n));return((1+floor(-log(abs(Pi-A[1,n]/A[2,n]))/log(10)))/(floor(log(A[1,n])/log(10)+1)+floor(log(A[2,n])/log(10)+1)‌​)+0.0);};


but this should be optimised.

Also note that: a) It is enough to consider convergents instead of any rational number. b) Something weaker than $\pi$ being a Khinchin-Lévy number would suffice, but this is the easiest way to see what's going on (the question is related to "how do the rational approximations to $\pi$ behave" anyways).

• The combination of this and the other answer make me wonder whether there's any known correlation between the 'Khinchin-ness' of a number and its irrationality measure... – Steven Stadnicki Mar 27 '15 at 19:15
• Being a Khinchin-Lévy number in the sense of satisfying both the displayed conditions I wrote implies having an irrationality measure of $2$ (obvious). But I don't know if having either of them implies anything about the irrationality measure. The point is, every result of this kind is of the form "almost all reals satisfy XXX", but those sets of measure $1$ are not the same in each theorem, so it would be more appropriate to speak of "Khinchin numbers", "Lévy numbers", "Lochs numbers" etc. – Emanuele Tron Mar 27 '15 at 20:00

The following fraction uses 13 digits to get to 30 decimal places:

ln(640320^3 + 744) / √163

Using ln is a cheat as it's the "natural logarithm" of a number, or its logarithm to the base e, where e is an irrational and transcendental constant approximately equal to 2.718281828459 so this is using one irrational number to approximate another which goes directly against the wording of the question.

Technically √7+√6+√5 (nested square roots) uses 3 digits to get 4 rounded digits of Pi as they both round to 3.1416 so it beats 355/113 ratio-wise as the question is worded even though it is a less accurate approximation.

The closest memorable example I could find that's more accurate than 355/113 is (2143/22)^(1/4) using 8 digits to get 8 accurate decimal places of Pi, but it's not "better" than 355/113 as worded in the question, and at this point you may as well remember Pi to 8 decimal places.

• This doesn't answer the question. – Ben Crowell Dec 14 '15 at 12:38