Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ames!ucbcad!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.lang.misc Subject: Re: Programs which print themselves out Message-ID: <21639@ucbvax.BERKELEY.EDU> Date: Fri, 6-Nov-87 15:24:05 EST Article-I.D.: ucbvax.21639 Posted: Fri Nov 6 15:24:05 1987 Date-Received: Sun, 8-Nov-87 20:33:09 EST References: <9015@shemp.UCLA.EDU> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 24 In article <9015@shemp.UCLA.EDU> lui@CS.UCLA.EDU (Stephen Lui) writes: >What is the shortest program, in some popular language like C or Pascal, which >prints itself out when executed? Starting with an arbitrary text file (such as this article), named "junk" the sequence: % mv junk junk.c % cc junk.c >& junk repeated 5 or 6 times quickly converges to a file which, when compiled generates itself as an error message. For any language, the null program, when run, generates itself as output. In Apl, or Lisp, the next largest answer is of course the program: 1 this program, when run, produces itself as a value. --- David Phillip Oster --A Sun 3/60 makes a poor Macintosh II. Arpa: oster@dewey.soe.berkeley.edu --A Macintosh II makes a poor Sun 3/60. Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu