## What does it do?

Stump your fellow simians.
Witness
Posts: 35689
Joined: Thu Sep 19, 2013 5:50 pm

### What does it do?

Found this small program in a book:

Code: Select all

int a=10000,b,c=8400,d,e,f[8401],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);}

Doctor X
Posts: 75244
Joined: Fri Jun 04, 2004 8:09 pm
Title: Collective Messiah
Location: Your Mom

### Re: What does it do?

Simple:
Your stereo is mine, of course. . . .

--J.D.
Rob Lister
Posts: 23535
Joined: Sun Jul 18, 2004 7:15 pm
Title: Incipient toppler
Location: Swimming in Lake Ed

### Re: What does it do?

Witness wrote:Found this small program in a book:

Code: Select all

int a=10000,b,c=8400,d,e,f[8401],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);}

Spoiler:
Never test cheaters.
DrMatt
BANNED
Posts: 29811
Joined: Fri Jul 16, 2004 4:00 pm
Location: Location: Location!

### Re: What does it do?

Obscure code is no longer impressive.
We've all heard the story of Mel.
Witness
Posts: 35689
Joined: Thu Sep 19, 2013 5:50 pm

### Re: What does it do?

Well done Rob, you nailed it.

@ Matt: read the Mel story with pleasure, reminded me of a time when bits were set with switches. But I think the programmer diden't want to obfuscate (which I used, of course), just to show that lots of π's decimals could be generated with a handful of bytes.