I saw a pi calculate algorithm on a website and it looks like 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 was said this code was based on this expansion,but i do not understand the relative between the code and the expansion.
pi= sigma( (i!) ^2*2^(i+1))/(2i+1)! (i=0 to infinite)
Could you help me explain it?Thanks.