Solve Proj Euler problem 007.