Solved Problem 17 on Project Euler