python sieve solution for problem 10