首页 > 代码库 > 10 001st prime number

10 001st prime number

这真是一个耗CPU的运算,怪不得现在因式分解和素数查找现在都用于加密运算。

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?

def isprime(n):
    boolisprime = True
    for i in xrange(2,n):
        if n % i == 0:
            boolisprime = False
    return boolisprime

def primenumber(n):
    i = 2
    x = 1
    while True:
        if isprime(i) == True:
            print i,x
            x += 1
        if x > n:
            break
        i += 1
    return i
print primenumber(10001)