Euler Project Problem 7