Possible Duplicate:
Golf you a quine for great good!

People have proposed short quines in various languages.

Puzzle: Find the shortest non-trivial quine in a language of your choice, and prove that it is the shortest. ("Trivial" quines are such things as the empty program, and text that will be echoed directly.)

I expect the solution will involve exhaustive search of all possible programs of length up to the length of the shortest known quine. Some cleverness is probably needed to reduce the search space to a tractable size, and filter out programs that are quines for trivial reasons.

  • \$\begingroup\$ Is an empty program on a script language a valid quine? Quines are quite boring things... BTW, I know the answer for HQ9+ \$\endgroup\$
    – JBernardo
    Jul 14, 2011 at 0:30
  • \$\begingroup\$ @JBernardo: That would count as trivial, as specified in the question. \$\endgroup\$ Jul 14, 2011 at 0:31
  • \$\begingroup\$ This isn't an exact duplicate: this question also asks for a proof that it's the shortest quine in its language. \$\endgroup\$
    – Joey Adams
    Jul 15, 2011 at 22:21
  • 1
    \$\begingroup\$ @Joey Adams: The proof was intended as the main part of the puzzle. \$\endgroup\$ Jul 16, 2011 at 1:44
  • \$\begingroup\$ If the language is Turing Complete, then the halting problem happens \$\endgroup\$
    – MilkyWay90
    Mar 26, 2019 at 0:29


Browse other questions tagged or ask your own question.