Created
March 8, 2017 04:37
-
-
Save itzsaga/4e1efbe7d7bd36ebdedd716edf12d56c to your computer and use it in GitHub Desktop.
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 prime?(n) | |
if n <= 1 | |
return false | |
elsif n <= 3 | |
return true | |
else (2..n/2).none? do |x| | |
n % x == 0 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment