Problem 21 in Ruby.
Performance is okay, maybe improve with a prime sieve.