In [1]:
MAX = 200000
index = 10001
sieve = [True] * MAX
prime_count = 0
for p in range(2, MAX):
if sieve[p]:
prime_count += 1
if prime_count == index:
print(p)
break
for n in range(p*p, MAX, p):
sieve[n] = False
The Sympy module makes this problem even easier.
In [2]:
from sympy import prime
print(prime(index))
In [ ]: