Notes

Chapter 4: Systems Based on Numbers

Section 5: Mathematical Constants


Computing n^th digits directly

Most methods for computing mathematical constants progressively generate each additional digit. But following work by Simon Plouffe and others in 1995 it became clear that it is sometimes possible to generate, at least with overwhelming probability, the n^th digit without explicitly finding previous ones. As an example, the n^th digit of Log[2] in base 2 is formally given by Round[FractionalPart[2^n Sum[2^-k/k,{k,∞}]]]. And in practice the n^th digit can be found just by computing slightly over n terms of the sum, according to

Round[FractionalPart[Sum[FractionalPart[ PowerMod[2,n-k,k]/k],{k,n}]+ Sum[2^n-k/k,{k,n+1,n+d}]]]

where several values of d can be tried to check that the result does not change. (Note that with finite-precision arithmetic, some exponentially small probability exists that truncation of numbers will lead to incorrect results.) The same basic approach as for Log[2] can be used to obtain base 16 digits in π from the following formula for π:

Sum[16^-k (4/(8k+1)-2/(8k+4)-1/(8k+5)-1/(8k+6)),{k,0,∞}]

A similar approach can also be used for many other constants that can be viewed as related to values of PolyLog.


From Stephen Wolfram: A New Kind of Science [citation]