Faster Pi

There is a more astonishing algorithm than what is described in “Fast Pi” for rapidly calculating \pi.

Let us consider the three-term iteration with initial values

a_0 = \sqrt{2}, \quad b_0 =0, \quad \pi_0 = 2+\sqrt{2}

given by

a_n = \frac{1}{2}\left(\sqrt{a_{n-1}} + \frac{1}{\sqrt{a_{n-1}}}\right), \quad b_{n} = \sqrt{a_{n-1}}\left(\frac{b_{n-1}+1}{b_{n-1} + a_{n-1}}\right), \quad \pi_{n} = \pi_{n-1}b_n\left(\frac{1+a_{n}}{1+b_{n}}\right).

Then \pi_n converges exponentially to \pi. In fact,

|\pi-\pi_n|< \frac{1}{10^{2^n}}.

Implemented in Omega CAS Explorer, 4 iterations yield 40 digits of \pi:

The 8th iteration gives \pi correctly to 694 digits:

Exercise-1 Show that 20 iterations will provide over 2 million digits of \pi.