Project Euler problem 10 solution