Created
December 15, 2012 01:21
-
-
Save maxwellE/4290270 to your computer and use it in GitHub Desktop.
Calculating Primes in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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