solution to project euler question #1