project euler之第10001个素数

import math
count = 0
num = 1
while count<10001:
    num +=1
    if num > 1:
        for i in range(2, int(math.sqrt(num))+1):
            if (num % i) == 0:
                break
        else:
            print(num, "是质数")
            count +=1
    else:
        print(num, "不是质数")
print(count)

 

posted @ 2018-07-07 15:43  托月的成长历程  阅读(232)  评论(0编辑  收藏  举报