Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Just finished calculating pi to 30 trillion places.
#13
(08-15-2022, 10:23 PM)Jack Wrote: Kernelpanic
Ramanujan’s Formula for Pi would go something like this, consider it pseudo-code
Code: (Select All)
pie=0
digits=16 'number digits
m=digits/8 'number of terms

for n=0 to m
    tmp=factorial(n)
    tmp=factorial(4*n)/(tmp*tmp*tmp*tmp) 'tmp^4
    pie=pie+tmp*(26390*n+1103)/(396^(4*n))
next
pie=pie*sqr(8)/9801
pie=1/pie
print pie

function factorial(n)
    f=1
    if n=0 then
        factorial=f
        exit function
    end if
    for i=1 to n
        f=f*i
    next
    factorial=f
end function

Nice work at applying the formula, Jack. It works up to 8 iterations before the binary computer math breaks it. Makes me with I had powers and square roots coded for my routine.

I'll hang on to this for some time in the future.

Pete
Reply


Messages In This Thread
RE: Just finished calculating pi to 30 trillion places. - by Pete - 08-15-2022, 11:02 PM



Users browsing this thread: 3 Guest(s)