solution to project euler problem 5; ruby