solution to project euler problem 2; python