The Almkvist-Giullera formula for calculating   1/π2   is based on the Calabi-Yau
differential equations of order 4 and 5,   which were originally used to describe certain manifolds
in string theory.



The formula is:

 1/π2 = (25/3) ∑0∞ ((6n)! / (n!6))(532n2 + 126n + 9) / 10002n+1


This formula can be used to calculate the constant   π-2,   and thus to calculate   π.

Note that, because the product of all terms but the power of 1000 can be calculated as an integer,
the terms in the series can be separated into a large integer term:

  (25) (6n)! (532n2 + 126n + 9) / (3(n!)6)      (***)
multiplied by a negative integer power of 10:

  10-(6n + 3) 


Task

 Print the integer portions (the starred formula, which is without the power of 1000 divisor) of the first 10 terms of the series.
 Use the complete formula to calculate and print π to 70 decimal digits of precision.


Reference

  Gert Almkvist and Jesús Guillera, Ramanujan-like series for 1/π2 and string theory, Experimental Mathematics, 21 (2012), page 2, formula 1.


[* factorial *]sz
[ 1 Sp [ d lp * sp 1 - d 1 <f ]Sf d 1 <f Lfsz sz Lp ]sF
 
[* nth integral term *]sz
[ sn 32 6 ln * lFx 532 ln * ln * 126 ln * + 9 + * * 3 ln lFx 6 ^ * / ]sI
 
[* nth exponent of 10 *]sz
[ 1 + 6 * 3 r - ]sE
 
[* nth term in series *]sz
[ d lIx r 10 r lEx _1 * ^ / ]sA
 
[* sum of the first n terms *]sz
[ [li lAx ls + ss li 1 - d si 0 r !<L]sL si 0ss lLx ls]sS
 
[* approximation of pi after n terms *]sz
[ lSx 1 r / v ]sP
 
[* count digits in a number *]sz
[sn 0 sd lCx ld]sD
[ld 1 + sd ln 10 0k / d sn 0 !=C]sC
 
[* print a number in a given column width *]sz
[sw d lDx si lw li <T n]sW
[[ ]n li 1 + si lw li <T]sT
 
[* main loop: print values for first 10 terms *]sz
[N. Integral part of Nth term .................. × 10^ =Actual value of Nth term]p
0 sj
[
  lj n [. ]n
  lj lIx 0k 1 / 44 lWx [ ]n
  lj lEx 4 lWx [ ]n
  lj 99k lAx 50k 1 / p
  lj 1 + d sj 10 >M
] sM
lMx
 
[]p
 
[* print resulting value of pi to 70 places *]sz
[Pi after ]n 52n [ iterations:]p
99k 52 lPx 70k 1 / p