solution to project euler problem 8; ruby