In fact, I wasn't sure about the full story but the fact that Wikipedia repeatedly told that Plouffe alone discover the formula makes me think that there is a story behind that.
Not this one, but algorithms that can calculate the specific digit positions but nothing else are indeed used for world records, mainly for the verification. If two radically different algorithms converge into the same digits at something like the trillionth position then you will have a high confidence for the rest of digits.
Decimal is the only tricky one. Given that tau=2pi, simple use f(n-1) in the original binary formula for pi, and I’m sure something just as trivial for hex.
Yes, and there's also bold (𝛑), bold italic (𝝅), sans-serif bold (𝝿), and sans-serif bold italic (𝞹), all distinct from the run-of-the-mill Greek Small Letter Pi (π) which is often rendered quite differently from the "standard mathematical pi" in addition to, of course, being semantically different. There's a lot of fun stuff in the Mathematical Alphanumeric Symbols block (https://unicode-table.com/en/blocks/mathematical-alphanumeri...)
Mathematicians (and other math subjects) use an interesting notation that is something like a "semantically local variable". A symbol like n can be reused multiple times, as long as the context is clear you're allowed to do that.
Is there a physical limit to how many digits of pi can ever be computed/represented in the universe?
For example, let’s say we need one atom for each digit of pi that we want to store, the max limit of digits of pi would be something like the total number of atoms in the universe, minus the atoms required to compute and store the digits.
What do you mean that we “only need” 63 decimal places?
A computer can calculate and hold a lot more than 63 digits.
So I guess my question is more like: if the universe was just one big computer dedicated only to calculating (and storing) digits of pi, how many digits could it get to calculate, max?
It is all curious, but it seems that procedure that calculates the n-th digit using some other functions that require O(n) calculations (i.e. Bernoulli numbers) is not that exciting, as it's just a speedup comparing to a naive calculation (maybe a big one but still).
Although because pi is a transcendental number maybe it is impossible to have an algorithm to return the n-th digit in O(1) operations? Does anyone know ?
Upd: thinking more about it, just to read all the digits of number n, one needs log(n) operations, so I guess anything that has performance of O(log(n)) can be considered easy (i.e. the digits of rational numbers can be computed in O(logn).
The normal method for computing digits of pi is not O(n), so this could still be interesting. I think it's probably better to compare this with the BBP formula [1]. The commonly used algorithm for pi I think still takes O(n log^3 n) time [2]
Even rational numbers which have repeating digits at the end are not O(1) because in order to calculate the n-th digit you need to calculate n modulo k where k is the length until the number repeats its digits, which needs to read the entire input number n (thus runs in O(log(n)).
The only exception are rational numbers with k being a power of two.
Take 0.1010101010…, you can get the n-th digit by reading off the smallest digit of n and checking whether it is a 0 or a 1.
There are transcendental numbers where the n-th digit can be computed in O(log n) like Champerowne constant though.
Chatgpt, please write a function in python for the nth digit of pi.
Sure, here is a function in Python that calculates the nth digit of Pi using the Chudnovsky algorithm:
from decimal import *
def nth_digit_of_pi(n):
getcontext().prec = n + 1
C = 426880 * math.sqrt(10005)
M = 1
L = 13591409
X = 1
K = 6
S = L
for i in range(1, n):
M = (K ** 3 - 16 * K) * M // i ** 3
L += 545140134
X *= -262537412640768000
S += Decimal(M * L) / X
K += 12
return +str(S / C)[n]
Interesting! If you correct the obvious errors, then it appears to calculate 1/pi:
>>> from decimal import Decimal
>>> import math
>>>
>>> def nth_digit_of_pi(n):
... getcontext().prec = n + 1
... C = Decimal(426880 * math.sqrt(10005))
... M = 1
... L = 13591409
... X = 1
... K = 6
... S = L
... for i in range(1, n):
... M = (K ** 3 - 16 * K) * M // i ** 3
... L += 545140134
... X *= -262537412640768000
... S += Decimal(M * L) / X
... K += 12
... return str(S / C)[n]
...
>>> "".join([ nth_digit_of_pi(i) for i in range(50) ])
'0.318309886183790698041462054251035408427213165074'
I don't understand this claim on the bottom of page 1 (emphasis added):
> It is easy to verify that with n = 1000, the error on π is of the order of 0.293193 x 10^-303, which is less than 2^-1000. So the thousandth position of this expression is the 1000th bit of the number π.
How does that follow? Take the number 1 - 2^-n. The difference between this number and 1 is 2^-n by definition, so it can be made arbitrarily small by varying n, but all bits are wrong. Addition can propagate all the way to the "decimal" point (and even beyond), so an error bound doesn't normally say anything about individual bits or digits. What am I missing here?
He used to teach in my university. He is a fantastic man. This is serious, he is crazy about numbers. He is one of the guy behind OEIS (oeis.org).
That is not the first formula he found about pi and some of the previous one had been used to break world record about the number of known decimals.
In my very personal opinion, the overall publication history of the three provides some rather good evidence for Plouffe's claims.
In fact, I wasn't sure about the full story but the fact that Wikipedia repeatedly told that Plouffe alone discover the formula makes me think that there is a story behind that.
In other words, for say 𝜋^50 does the formula only give me the 50th digit, or does it give me any arbitrary digit I want?
Yes.
> In other words, for say 𝜋^50 does the formula only give me the 50th digit
Yes.
> or does it give me any arbitrary digit I want?
It gives you the n-th digit of \pi^n. Here n is arbitrary.
The abstract and text say the nth digit of \pi^n, and the worked example on page 2 uses the same n=1000 to find the thousandth digit of \pi^{1000}.
Deleted Comment
For example, let’s say we need one atom for each digit of pi that we want to store, the max limit of digits of pi would be something like the total number of atoms in the universe, minus the atoms required to compute and store the digits.
Has that been studied/calculated?
A computer can calculate and hold a lot more than 63 digits.
So I guess my question is more like: if the universe was just one big computer dedicated only to calculating (and storing) digits of pi, how many digits could it get to calculate, max?
Although because pi is a transcendental number maybe it is impossible to have an algorithm to return the n-th digit in O(1) operations? Does anyone know ?
Upd: thinking more about it, just to read all the digits of number n, one needs log(n) operations, so I guess anything that has performance of O(log(n)) can be considered easy (i.e. the digits of rational numbers can be computed in O(logn).
[1] https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%9...
[2] https://en.wikipedia.org/wiki/Chudnovsky_algorithm
There are transcendental numbers where the n-th digit can be computed in O(log n) like Champerowne constant though.
https://en.wikipedia.org/wiki/Chaitin%27s_constant
cmeacham98's constant: a number where the `n`th digit is the `2^n`th digit of pi
> It is easy to verify that with n = 1000, the error on π is of the order of 0.293193 x 10^-303, which is less than 2^-1000. So the thousandth position of this expression is the 1000th bit of the number π.
How does that follow? Take the number 1 - 2^-n. The difference between this number and 1 is 2^-n by definition, so it can be made arbitrarily small by varying n, but all bits are wrong. Addition can propagate all the way to the "decimal" point (and even beyond), so an error bound doesn't normally say anything about individual bits or digits. What am I missing here?