Skip to content

Instantly share code, notes, and snippets.

@mcvarer
Created October 20, 2020 18:33
Show Gist options
  • Save mcvarer/69e3b058e13861377b64d4d5702f0068 to your computer and use it in GitHub Desktop.
Save mcvarer/69e3b058e13861377b64d4d5702f0068 to your computer and use it in GitHub Desktop.
projecteuler: 7
"""
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
"""
import sympy.ntheory as nt
def primeNumber10001():
nd = 10001
i, j = 0, 0
while True:
if nt.isprime(i):
j += 1
if nd == j:
print("10001. prime is = {}".format(i))
break
i += 1
primeNumber10001()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment