Project Euler Problem 1 solution