Ruby Solution for Project Euler #6