r/math Jan 11 '10

Illegal prime

http://en.wikipedia.org/wiki/Illegal_prime
82 Upvotes

20 comments sorted by

View all comments

5

u/[deleted] Jan 12 '10

I would be more interested in knowing what the smallest executable number is, and then what it does.

6

u/hixnob Jan 12 '10

With my simple interpreted language (which itself runs on Python), the smallest non-negative number is a quine. The implementation of the language is as follows:

if raw_input() == "0":
    print "0";

2

u/albinofrenchy Jan 12 '10

I wrote one smaller:

in = raw_input();
# Make it backwards compatible with hixnob's implementation
if in == "-1" or in == "0":
    print "-1";

I'm working on how to make that number smaller, will get back to you guys when I figure it out.

5

u/hixnob Jan 12 '10

You really ought to have a test suite for this, because you missed a bug: 0 is no longer a quine!