My notes Pi Proof that Pi is Irrational The Gregory-Leibniz Series The Wallis Product Ramanujan’s Formula for Pi Computing Pi in C Dik T. Winter wrote a 160-byte C program to compute the first 800 digits of pi. We analyze his code here. The original code int a=10000,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5; for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)for(b=c;d+=f[b]*a, f[b]=d%--g,d/=g--,--b;d*=b);} can be rewritten as: #include <stdio.h> int main() { int r[2800 + 1]; int i, k; int b, d; int c = 0; for (i = 0; i < 2800; i++) { r[i] = 2000; } for (k = 2800; k > 0; k -= 14) { d = 0; i = k; for (;;) { d += r[i] * 10000; b = 2 * i - 1; r[i] = d % b; d /= b; i--; if (i == 0) break; d *= ...