#Find the Nth prime number
n = 10001
primes = [2,3,5,7]
k = 11
while n >= len(primes):
m = k**0.5
for p in primes:
if p > m:
primes.append(k)
break
if k%p == 0:
break
k+=2
print(primes[n-1])
A small code to find a term in series of prime numbers. i.e. Nth prime number.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.