Prime number tester


/ Published in: Regular Expression
Save to your folder(s)

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.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.