Project Eueler: problem7
問題
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?
回答
prime = [2] flg = 0 (3..9999999).each do |n| flg = 0 prime.each do |p| if n % p == 0 flg = 1 break end end prime.push(n) if flg == 0 if prime.size == 10001 p prime[10000] break end end