Skip to content

Instantly share code, notes, and snippets.

@maxwellE
Created December 15, 2012 01:21
Show Gist options
  • Save maxwellE/4290270 to your computer and use it in GitHub Desktop.
Save maxwellE/4290270 to your computer and use it in GitHub Desktop.
Calculating Primes in Ruby
def isPrimeRegexp 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