Skip to content

Instantly share code, notes, and snippets.

@epid
Created July 23, 2010 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epid/487480 to your computer and use it in GitHub Desktop.
Save epid/487480 to your computer and use it in GitHub Desktop.
def is_prime(n)
("1" * n) !~ /^1?$|^(11+?)\1+$/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment