a[1<<20];n;main (){while(!(n>>20))n=++a[n]?0:n+1;}
/*
Quite slow program in 49 characters
Andrew Belt
Assuming an int is 32 bits, this program halts in around 2^(32*2^20) loops.
This will take at least 10^10100890 years.
The array `a` is essentially a large integer spread across consecutive ints.
This program simply increments the integer and halts when it overflows.
I believe this approach gives the most loops possible with a state variable of 4*2^20 bytes (4 MiB).
Future improvements might include allocating memory on the heap instead, or opening and closing emacs in each iteration of the loop.
*/