Skip to content

Instantly share code, notes, and snippets.

@heftig
Forked from anonymous/primes.rb
Created April 27, 2012 21:11
Show Gist options
  • Save heftig/2513252 to your computer and use it in GitHub Desktop.
Save heftig/2513252 to your computer and use it in GitHub Desktop.
primes = [2]
current_number = 3
while primes.length < 10
primes.push(current_number) unless primes.any? { |p| current_number % p == 0 }
current_number += 2
end
puts primes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment