Project Euler exercise 1