Ruby Project Euler, second try