Solution to problem 3-project euler