Skip to content

Instantly share code, notes, and snippets.

@charlesponti
Created May 6, 2013 18:09
Show Gist options
  • Save charlesponti/5526924 to your computer and use it in GitHub Desktop.
Save charlesponti/5526924 to your computer and use it in GitHub Desktop.
Project Euler: Problem 10
def is_prime?(num)
2.upto(num-1) { |i| return false if ((num % i) == 0) }
true
end
def sum_primes(max)
sum = 0
2.upto(max-1) { |i| sum += i if is_prime?(i) }
p sum
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment