I found out Prime.new in the mathn library in Ruby. I was using it to generate primes for a problem. I want to iterate over all primes between 1 and 1000 using Primes.new. Is there any way to use Prime.new in a for loop or iterate over primes in some way?
I found out Prime.new in the mathn library in Ruby. I was using it
Share
You can also get the n first prime numbers like that :
cf : http://www.ruby-doc.org/gems/docs/b/backports-2.6.1/Prime.html
EDIT : to get the n first prime numbers with above a given value, I would so something like that (this is a draft)