Livejournal
Log in
Post
Friends
My journal
myrathi
Mm. PI.
May 09, 2005 16:42
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);}
pi to 800 digits. In 160 characters of code. Woo! 0_o
Leave a comment
Comments 8
Well
lambertbehnke
May 9 2005, 16:18:01 UTC
Missing the decimal point of course,
and the last digit is the correct one but where you to finish your number there you'd round up.
Still fairly impressive,
beats the question though ... How did anyone find that out???
Oh well.
Lambert
(P.S.: And yes I did get the C compiler out and checked it ... sad I know)
Reply
Re: Well
myrathi
May 9 2005, 16:53:51 UTC
Yeah. To be specific, it should really insert the '.' and suffix '...' or something.
But still. Woo.
Reply
Re: Well
lambertbehnke
May 9 2005, 16:55:21 UTC
How did anyone work it out?
That's the question.
Reply
Re: Well
myrathi
May 9 2005, 16:57:10 UTC
It was an "obfuscated C" competition entry some time back. These people are just scary intelligent. :>
Reply
Thread 8
Leave a comment
Up
Comments 8
and the last digit is the correct one but where you to finish your number there you'd round up.
Still fairly impressive,
beats the question though ... How did anyone find that out???
Oh well.
Lambert
(P.S.: And yes I did get the C compiler out and checked it ... sad I know)
Reply
But still. Woo.
Reply
That's the question.
Reply
Reply
Leave a comment