In [1]:
from euler import gen_prime
from itertools import islice

In [2]:
list(islice(gen_prime(), 6))


Out[2]:
[2, 3, 5, 7, 11, 13]

In [3]:
def foo(n):
    return list(islice(gen_prime(), n))[-1]

In [4]:
n = 10001
%timeit foo(n)
foo(n)


The slowest run took 209.25 times longer than the fastest. This could mean that an intermediate result is being cached.
1000 loops, best of 3: 896 µs per loop
Out[4]:
104743

In [5]:
209.25 * 896


Out[5]:
187488.0