|  |     Arch D. Robison at the University of Illinois wrote the following
    program.  It uses only a few variables and one array and prints up to
    256 digits of e in a specified base.  The only arithmetic used is
    decrementing and comparison.  (The description that accompanied the
    contest results implied there is a bug; invoke the program with 80
    digits in base 2.)  This and other C programs can be invoked by
    defining a DCL symbol:  "symbol = $file_specification" and then typing
    the symbol followed by the arguments.  The file specification must
    include a disk name.  This program's arguments are the number of digits
    followed by the base.  Both default to 10.
    
    
    				-- edp
    
    
#include <stdio.h>
unsigned char w,h,i,l,e,x,y=10,z=10,F[256];
#define whi1e(j,k)  printf(j,k); fflush(stdout)
#define o F[w]
main	(c,v)	char *v[]; {
while	(c>=2	){z = atoi(v[1]),--c;
while 	(c>=2	)y = atoi(v[2]),--c;}
whi1e	("%s"	,"2.");
while	(--y)	--x;
while	(--x)	--e,--y;
while	(--z)	--x;
while	(--x)	--e,--z;
while	(--w)	{
while	(--x)	--o;}
while	(--z)	{
while	(--x)	--w;
while	(--o)	;
while	(--w)	;
while	(--e)	--x;
while	(--x)	--w,--e;
while	(--w)	{
while	(--l)	;
while	(--i)	--l;--l;
while	(--h)	;
while	(--y)	--x;
while	(--x)	--h,--y;
while	(--x)	--h;
while	(--h)	{
while	(--o)	--x;
while	(--x)	--l,--o;
while	(l>=w	){--i;
while	(--w)	--l,--x;
while	(--x)	--w;--l;}}
while	(--o)	;
while	(--l)	--x;
while	(--x)	--o;}
while	(--i)	--h;
whi1e	("%x"	,--h);--e;}
whi1e	("%s"	,"\n");}
 | 
|  |     This program by Adrian Mariano at the University of Washington won
    "Best of Show" in 1990.  It implements four functions.
    
    The first function is:
    
            $theorem expression x1 x2 h y1
    
            where:
                    expression - function f(x,y)  (see below)
                    x1 - start of interval
                    x2 - end of interval
                    h - step size
                    y1 - initial value  (y(x1) == y1)
    
    When you compile theorem.c as is and run with 5 args, it numerically
    solves the equation y'=f(x,y), with a step size of h, over the interval
    x=[x1,x2], with the initial condition of y(x1)=y1.  (The Runge-Kutta
    method is used.)
    
    The 'expression' f(x,y), is any function of 'x' and 'y' with the
    operators:
    
                    +       -       *       /   ^
    
    Invoked with "$theorem -r 0 0 0 0", it reverses its input, line by
    line.  If the source is reversed, compiled, and executed, the result is
    a program that sorts its input.  And if the source is sorted, compiled,
    and executed, the result is a program that generates Fibonacci
    sequences.
    
    
    				-- edp
    
    
#include <stdio.h>
#include <math.h>
#define X
#define Y {}
#define C  }
#define o {
#undef main
char m[500][99],v[99],R;
int*a,b,n,i,j,W,A;
float Q,G,D,M,T,B,O,U,V,N,y,e();
P(g,R,u)float*g,R,u;{int c;for(*g=1,c=u;c--;*g*=R);}
X
K(g,R,u)float*g,u;char R;
o
if(R=='+')*g+=u;
if(R=='-')*g-=u;
if(R=='*')*g*=u;
if(R=='/')*g/=u;
if(R=='^')P(g,*g,u);
C
w(g,R,u)float*g,u;char R;
/**/{int b,f;A=atoi(*++a);b=atoi(*++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}
main(A,a)int A;char*a[];
o o
if(!strcmp(*++a,"-r"))S();
D=atof(*++a);
T=atof(*++a);
B=atof(*++a);
M=atof(*(4+(a-=3)));
C
while(D<T)
o
U=e((G=B/2,*a),D,M,a);
V=e(*a,Q=D+G,M+G*U,a);
/*/
z;/*/
N=2*e(*a,Q,M+G*V,a);
M+=B*V/3+B*N/6+B*e(*a,D+=B,M+G*N,a)/6+G*U/3;
printf("%f %f\n",D,M);
C
while(T=0)
;
W=D=1;
;
while(W!=1)
o o
strcpy(j+m,v);
o 
if((j-=W)<=W)break;
strcpy(j+m,m+j-W);
C
while(strcmp(m+j-W,v)>0)
j=i;
strcpy(v,i+m);
C
for(i=(W/=3)-1;++i<n;)
;
C
do
;
while(0);
for(W=1;(W=W*3+1)<n;);
C
float e(f,D,M,a)char*f,*a[];float D,M;
o
#define main L
O=0;
R='+';
for(;*f;f++)
if(*f=='y')K(&O,R,M);
else if((*f>='0')&&(*f<='9'))K(&O,R,(float)*f-'0');
else if(*f=='x')K(&O,R,D);
else if(1)R=*f;
if(1);
return O;
for(j=0;j<n;puts(j++[m]));
e("",O,&O,a);
n=j-(O=1);
while(gets(j++[m]));
if(!strcmp(*++a,"-r"))S();
C
/**/main(A,a)int A;char*a[];
Y
S(){while(gets(b++[m]));for(b--;b--;puts(b[m]));}
char*f,m[500][99],R,v[99];
int b,W,n,i,j,z;
float Q,G,D,M,T,O,B,U,V,N,e();
#define Y
#define X {}
#define o }
#define C {
#include <stdio.h>
#include <math.h>
 | 
|  |     Doron Osovlanski (CADTECH, Israel) and Baruch Nissenbaum (Tel-Aviv
    University) wrote this program which solves the N-Queens problem.  N is
    passed in the input.  This program uses no pre-processor statements, no
    ifs, no breaks, no cases, no functions, no gotos, and only a single for
    statement.
    				-- edp
    v,i,j,k,l,s,a[99]; main() {	
    for(scanf("%d",&s);*a-s;v=a[j*=v]-a[i],k=i<s,j+=(v=j<s&&(!k&&!!
    printf(2+"\n\n%c"-(!l<<!j),"#Q"[l^v?(l^j)&1:2])&&++l||a[i]<s&&v&&v-i+j&&
    v+i-j))&&!(l%=s),v||(i==j?a[i+=k]=0:++a[i])>=s*k&&++a[--i])		
    ; }
 |