Live data from Hacker News

A formula for the nth digit of πœ‹ and πœ‹^n

arxiv.org

31–40 of 143 posts

Re: A formula for the nth digit of πœ‹ and πœ‹^n

#32
post #4

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…

Yeah, that's the joke.

Re: A formula for the nth digit of πœ‹ and πœ‹^n

#33
post #22

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?

The article title says "powers of πœ‹", so presumably an arbitrary digit.

Re: A formula for the nth digit of πœ‹ and πœ‹^n

#34
post #32

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.

Ah, I'm slow. Thanks

Re: A formula for the nth digit of πœ‹ and πœ‹^n

#36
post #4

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…

From the repo:

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) :)

Re: A formula for the nth digit of πœ‹ and πœ‹^n

#37

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…

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'
Post reply on HN