kareemgrant
10/19/2012 - 12:06 AM

Script that prints the 10,001st prime number

Script that prints the 10,001st prime number

require 'mathn'

prime_array = []
TARGET = 10001

Prime.each do |prime|
  if prime_array.size < TARGET
    prime_array.push(prime)
  else
    break
  end  
end

puts "The 10,001st Prime Number is #{prime_array.last}"