Problem 10 (written in Ruby)
def prime?(n)
return false if n % 2 == 0
lim = Math.sqrt(n).to_i
3.step(lim, 2) do |i|
return false if n % i == 0
end
return true
endtotal = 0
1.upto(2000000) do |n|
total += n if prime?(n)
endp total
Problem:
http://odz.sakura.ne.jp/projecteuler/index.php?Problem%2010