def solution(): primes = next_prime() # Throw away the first 10000 for x in xrange(10000): next(primes) # Here's the 10001st return next(primes)
def yield_primes_under(x): primes = next_prime() p = next(primes) while p < x: yield p p = next(primes)