Skip to content

Instantly share code, notes, and snippets.

@alex-quiterio
Created August 31, 2013 19:33
Show Gist options
  • Save alex-quiterio/6400137 to your computer and use it in GitHub Desktop.
Save alex-quiterio/6400137 to your computer and use it in GitHub Desktop.
natural_primer = ->(number) {
primes = [1]
number.times do
next_prime = primes.reduce(:*) + 1
primes << next_prime
end
puts primes[1..-1].join(', ')
}
unless ARGV[0].nil?
natural_primer.(ARGV[0].to_i)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment