Project Euler Solution for Problem 7