solution to project euler problem 17; python