Skip to content

Instantly share code, notes, and snippets.

@wnoizumi
Created April 26, 2013 00:19
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 wnoizumi/5464283 to your computer and use it in GitHub Desktop.
Save wnoizumi/5464283 to your computer and use it in GitHub Desktop.
def prime?(n)
(2..Math.sqrt(n)).each do |i|
return false if n % 2 > 0
end
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment