Completed Project Euler Problem 31