Skip to content

Instantly share code, notes, and snippets.

@bragboy
Created November 12, 2015 10:40
Show Gist options
  • Select an option

  • Save bragboy/19035486266f177427c9 to your computer and use it in GitHub Desktop.

Select an option

Save bragboy/19035486266f177427c9 to your computer and use it in GitHub Desktop.
def is_prime(n)
return false if n <= 1
2.upto(Math.sqrt(n).to_i) do |x|
return false if n%x == 0
end
true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment