TOPICS
Search

Digit-Extraction Algorithm


An algorithm which allows digits of a given number to be calculated without requiring the computation of earlier digits. The BBP formula for pi is the best-known such algorithm, but an algorithm also exists for e.

Plouffe (2022) gives a particularly simple digit-extraction algorithm for the decimal digits of pi by defining

 pi_n=((2(-1)^(n+1)(2n)!)/(2^(2n)B_(2n)(1-2^(-n))(1-3^(-n))(1-5^(-n))(1-7^(-n))))^(1/(2n)).
(1)

Then the nth digit to the right of the decimal point of pi for n>=3 is given by

 d_n=int(10frac(10^(n-1)pi_(n-1)))
(2)

where int(x) is the integer part and frac(x) is the fractional part. Similar formulas can be obtained using

 lim_(n->infty)((2^(2n+2)(-1)^n(2n)!)/(E_(2n)))^(1/(2n+1))=pi
(3)

and

 lim_(n->infty)((2^(2n+2)(-1)^n(2n)!)/(E_(2n))(1-1/(3^(2n+1))))^(1/(2n+1))=pi,
(4)

where E_n is an Euler number, which gives a base-9 (or binary) digit extraction formula (Plouffe 2022). Similar results can be also obtained for pi^2, pi^n, pi^(2n+1), e^pi, lnpi, and sqrt(pi) (Plouffe 2022).


See also

BBP Formula, Pi Digits, Pi Formulas

Explore with Wolfram|Alpha

References

Plouffe, S. "A Formula for the n'th Decimal Digit or Binary of pi and pi^n." https://arxiv.org/abs/2201.12601. 29 Jan 2022.

Referenced on Wolfram|Alpha

Digit-Extraction Algorithm

Cite this as:

Weisstein, Eric W. "Digit-Extraction Algorithm." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/Digit-ExtractionAlgorithm.html

Subject classifications