Solution 1 for Project Euler