#The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. #Find the sum of all the primes below one million. def getsum @sum=0 a=(2..1_000_000).to_a while a.size>0 @sum+=(pr=a[0]) a.reject! {|k| k%pr==0} end end require 'benchmark' Benchmark.bm(30){|x| x.report('results of getsum:') {getsum} } puts @sum