Euler Project Problem 10