Skip to content

Instantly share code, notes, and snippets.

@ox
Created October 10, 2012 18:47
Show Gist options
  • Save ox/3867619 to your computer and use it in GitHub Desktop.
Save ox/3867619 to your computer and use it in GitHub Desktop.
find the first 10 primes
(1..10).each do |n|
prime = true
(2..n-1).each do |x|
prime = false if n % x == 0
end
puts n if prime
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment