solution to project euler problem 10; ruby