#By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
#What is the 10001st prime number?
#answer : 104743
#
require "mathn"
def order_of_prime number
gen = Prime.new
gen.each_with_index do |prime,index|
if (index+1 == number.to_i)
puts prime
break
end
end
end
order_of_prime(10001)
ProjectRuler-7
最新推荐文章于 2011-11-04 12:45:45 发布