For this Python project, I present the first few hexadecimal significant figures of pi (see below for the first 40,000 hexadecimal digits, and a few binary digits of ln(2)). My Python program, running on my home PC, calculated the first 10,000 hexadecimal digits of pi in about 45 minutes.
The method I implemented was that of Bailey’s papers (BBP formula, 1997 and 2006). It is a remarkable method to calculate a given hexadecimal digit of pi, n places behind the decimal point, without the need to calculate any of the intermediate digits, 1…(n-1). Bailey presents integrals, which are identical to the infinite series which make up the BBP Formula:
Consider the dth hexadecimal digit of pi (each multiple of 16 moves the hexadecimal place over by one)) . The below BBP formula computes the "dth" hexadecimal digit of pi, behind the decimal point:
The beauty of this formula is to know the dth digit of pi, without needing a lengthy calculation to determine all the preceeding digits of pi. When we multiply by 16 in succession, the modulus of the numerator is sufficient - the whole numerator is not needed. The {.} notation represents a fractional part only, 0 < {.} < 1. The fractional part, {.}, allows use of a fast binary modulus algorithm to find the numerators for large k (or large i).
Below are the first 40,000 hexadecimal digits, should you wish to download and take a peek.
How round is the moon? ~ How many significant figures of pi are needed to describe its roundness? (my recent photo).
INTERESTING FACT! Consider the below 40,000 hexadecimal digits of pi, and define delta pi = (pi of 40,000 digits - pi of 39,999 digits). Define the volume of the Universe as 4/3 pi (50 billion light years)**3. One will now see that delta(Universe) = 4/3 delta(pi) (50 B LY) < volume of a single atom!!
Click to download txt file of first 40,000 hexadecimal digits of pi. Let me know if you have need for the first 1,000,000 hexadecimal digits of pi. My Python program reconciled with Bailey's published digits in the million, and 10-millionth digit ranges.
ln(2) = 0.101100010111001000010111111101111101000111001111011110011010101111001001111000111011001110011000000000111111001011110110101011110100000011110011010000110010011001110010100