Skip to content

Instantly share code, notes, and snippets.

@kareemgrant
Created October 19, 2012 00:06
Show Gist options
  • Save kareemgrant/3915511 to your computer and use it in GitHub Desktop.
Save kareemgrant/3915511 to your computer and use it in GitHub Desktop.
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}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment