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β¦
A formula for the nth digit of π and π^n
21β30 of 143 posts
Re: A formula for the nth digit of π and π^n
#22In other words, for say π^50 does the formula only give me the 50th digit, or does it give me any arbitrary digit I want?
Re: A formula for the nth digit of π and π^n
#23Plouffe ... 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.
Ok, so the method is real but will not be used to break the next world record. Chudnovsky algorithm is better at that task.
Re: A formula for the nth digit of π and π^n
#24Chatgpt, 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β¦
since this is Python, `nth_digit_of_pi(-1)` should give us the last number of Pi.
Re: A formula for the nth digit of π and π^n
#25Re: A formula for the nth digit of π and π^n
#26Chatgpt, 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β¦
Re: A formula for the nth digit of π and π^n
#27Re: A formula for the nth digit of π and π^n
#28Finally, we can find the last digit of pi
Re: A formula for the nth digit of π and π^n
#29So does it mean that these pi-calculating competitions & record are now going to devolve to special olympiads in pointless storage capacity? What will the super computers going to do in view of this discovery? Fascinating times for humans as well as for the machines...
Οfs: Never worry about data again! - https://github.com/philipl/pifs
Re: A formula for the nth digit of π and π^n
#30The interesting question, I think, is whether this formula can help address the question of the normality of pi: http://en.wikipedia.org/wiki/Normal_number This is particularly exciting because the prevailing opinion had been that we lack the mathematical tools to attack that problem.