Solve Euler problem 10