The Chudnovsky algorithm is a fast method for calculating the digits of π. It was published by the Chudnovsky brothers in 1989, and was used in the world record calculations of 2.7 trillion digits of π in December 2009, 5 trillion digits of π in August 2010, 10 trillion digits of π in October 2011, 12.1 trillion digits in December 2013 and 22.4 trillion digits of π in November 2016.
The algorithm is based on the negated Heegner number d = −163, the j-function j(1+√−163/2) = −3203, and on the following rapidly convergent 640generalized hypergeometric series:
For a high performance iterative implementation, this can be simplified to
There are 3 big integer terms (the multinomial term Mk, the linear term Lk, and the exponential term Xk) that make up the series and π equals the constant C divided by the sum of the series, as below:
Note that
This identity is similar to some of Ramanujan's formulas involving π, and is an example of a Ramanujan–Sato series.
π can be computed to any precision using the above algorithm in any environment which supports arbitrary-precision arithmetic. As an example, here is a Python implementation: