Skip to content

Instantly share code, notes, and snippets.

@yuush10
Created January 31, 2016 07:07
Show Gist options
  • Save yuush10/9d12b1823651b7f12c4e to your computer and use it in GitHub Desktop.
Save yuush10/9d12b1823651b7f12c4e to your computer and use it in GitHub Desktop.
def prime?
return false if num < 2
2.upto(Math.sqrt(num)) do |i|
if num % i == 0
return false
end
end
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment