Thompsons self duplicating program

Sjoerd Mullender sjoerd at vu44.UUCP
Fri Aug 31 19:16:39 AEST 1984


We have been able to squeeze out 4 more bytes from the shortest
self reproducing program until now.  Here it is:

char*p="char*p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);

This one is 76 characters long.  Of course it does not end with a
newline.  If you play dirty, you can substitute 'int' for 'char*'
(if sizeof (int) == sizeof (char *)), or better still (but not with
the Ritchie C compiler), just delete 'char*'.
---
			Sjoerd Mullender
				...!decvax!mcvax!vu44!sjoerd
			    &
			Robbert van Renesse
				...!decvax!mcvax!vu44!cogito



More information about the Comp.sources.unix mailing list