Wednesday, August 11, 2010

A test for primality, using regular expressions

/^1?$|^(11+?)\1+$/

That's it!

No comments: