Has anyone converted the formula to code?
n => Math.PI.toString()[n+2]31β40 of 143 posts
Has anyone converted the formula to code?
n => Math.PI.toString()[n+2]Earlier quoted context omitted.
Οfs: Never worry about data again! - https://github.com/philipl/pifs
Any file can be represented as a binary string, and a binary string is just an integer value - which is to say binary strings are simply indexes of files in binary space (i.e. the set of all possible permutations of bits). Looks to me like nfs is simply transforming a binary space index into a pi-space index. Some files may compress to a smaller value than they are in binary space (if you get lucky), but make no mistβ¦
In "nβth digit of π and π^n" are both n the same? 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?
Earlier quoted context omitted.
Any file can be represented as a binary string, and a binary string is just an integer value - which is to say binary strings are simply indexes of files in binary space (i.e. the set of all possible permutations of bits). Looks to me like nfs is simply transforming a binary space index into a pi-space index. Some files may compress to a smaller value than they are in binary space (if you get lucky), but make no mistβ¦
Yeah, that's the joke.
Earlier quoted context omitted.
Οfs: Never worry about data again! - https://github.com/philipl/pifs
Any file can be represented as a binary string, and a binary string is just an integer value - which is to say binary strings are simply indexes of files in binary space (i.e. the set of all possible permutations of bits). Looks to me like nfs is simply transforming a binary space index into a pi-space index. Some files may compress to a smaller value than they are in binary space (if you get lucky), but make no mistβ¦
Why is this thing so slow? It took me five minutes to store a 400 line text file!
Well, this is just an initial prototype, and don't worry, there's always Moore's law!
So I'm guessing they are quite aware of the joke, and props to them for the dedication to commit and write the code (or the other way around) :)
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β¦
>>> 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'This seems to be the catch.
> Note that the calculation of Bernoulli numbers can be done in several ways, one of which requires knowing Ο with good precision This seems to be the catch.