Euler problems 1-3 in Ruby