Done puzzle 64
[project-euler.git] / euler7.rb
1 primes = Array.new
2
3 2.upto 2000000 do |i|
4 primes << i
5 end
6
7 n = 0
8 while primes[n] ** 2 <= primes[-1]
9
10 primes.reject! {|i| i % primes[n] == 0 and i > primes[n]}
11 n = n+1
12 end
13
14 puts "found#{primes.length} primes"
15 puts "100th prime is #{primes[99]}"