Return to Snippet

Revision: 6788
at June 14, 2008 11:08 by banzaiman

Updated Code

Revision: 6787
at June 14, 2008 11:07 by banzaiman

Updated Code

Revision: 6786
at June 14, 2008 11:02 by banzaiman

Initial Code
print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/

Initial URL

Initial Description
By the legendary abigail.  Fails to match if and only if it is matched against a prime number of 1's.  That is, '11' fails, but '1111' does not.

I once heard him talk why this works, but I forgot most of it.

Initial Title
Prime number tester

Initial Tags

Initial Language
Regular Expression