c - Can not understand this pi calculate algorithm -
i saw pi calculate algorithm on website , looks that:
#include <stdio.h> int a[52514],b,c=52514,d,e,f=1e4,g,h; main(){ for(;b=c-=14;h=printf("%04d",e+d/f)){ for(e=d%=f;g=--b*2;d/=g){ d=d*b+f*(h?a[b]:f/5); a[b]=d%--g;} } }
it said code based on expansion,but not understand relative between code , expansion.
pi= sigma( (i!) ^2*2^(i+1))/(2i+1)! (i=0 infinite)
could me explain it?thanks.
pi+3=sigma( (m!)^2 * 2^m * m / (2*m)! ) (m=1 infinite).
algorithm's s pflouffe use it.
Comments
Post a Comment