If the digits of pi were as interesting as a video game, and the characters of the program were frames, then this is exactly like a time attack. But that's a bit of a stretch so this better go in the Off Topic.
I have been working on a new pi program, and I think I have come up with a program that I am satisfied with. Now I want to make sure that it runs properly on all machines, because I do some things that aren't exactly good programming practices to save space. My signature right now, suffers from this problem, it won't actually work on many machines/compilers.
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o:
53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
It should calculate pi to 2880 decimal places. I would like to know if there are any issues you have getting it to compile. There are some problems I already know about but am not willing to add the characters to fix:
-not giving type for g,o,p,i,a,main,x. To fix just add int everywhere
-printf not declared, include stdio.h
If these errors occur, I would still like to know to get an idea of what percent of people have these problems. I have made slightly shorter versions but I am pretty sure that even if they compile, they won't give the same output on all machines. All help is greatly appreciated.
In case you are curious the algorithm used is:
2 + 1/3*(2 + 2/5*(2 + 3/7*(2 + 4/9*(...))))
If anyone is interested, here are some other tiny codes I have written:
pi to 140 digits in 102 chars
b=1e6,a[27],t,n=995,i;main(){for(;i>24?i=t=!n--,
n--:n^3||cout<<t/n;t=n/2*a[i]+t%n*b,a[i++]=t/n)*a+=8;}
e to 992 digits in 87 chars
N,a[999],x;main(n){for(;n;--n?a[n]=x%n:printf(
"%d",x,n=998+--N))x=x/n+10*(a[n-1]+!~N);}
The algorithm is just like pi, but simpler:
2 + 1/2*(1 + 1/3*(1 + 1/4*(1 + 1/5*(...))))
(same as 1/0!+1/1!+1/2!+1/3!+...)