Working through Project Euler in Ruby