Chudnovsky algorithm

The Chudnovsky algorithm is a fast method for calculating the digits of , based on Ramanujan’s formulae. It was published by the Chudnovsky brothers in 1988 and was used in the world record calculations of 2.7 trillion digits of in December 2009, 10 trillion digits in October 2011, 22.4 trillion digits in November 2016, 31.4 trillion digits in September 2018–January 2019, and 50 trillion digits on January 29, 2020.
The algorithm is based on the negated Heegner number formula_1, the "j"-function formula_2, and on the following rapidly convergent generalized hypergeometric series:
A detailed proof of this formula can be found here:
For a high performance iterative implementation, this can be simplified to
There are 3 big integer terms (the multinomial term "Mq", the linear term "Lq", and the exponential term "Xq") that make up the series and equals the constant "C" divided by the sum of the series, as below:
The terms "Mq", "Lq", and "Xq" satisfy the following recurrences and can be computed as such:
The computation of "Mq" can be further optimized by introducing an additional term "Kq" as follows:
Note that
This identity is similar to some of Ramanujan's formulas involving , and is an example of a Ramanujan–Sato series.
The time complexity of the algorithm is formula_16.