Project Euler problem 1 solved