📜  python中使用函数的素数程序 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:15.726000             🧑  作者: Mango

代码示例4
import math

def main():
    count = 3
    
    while True:
        isprime = True
        
        for x in range(2, int(math.sqrt(count) + 1)):
            if count % x == 0: 
                isprime = False
                break
        
        if isprime:
            print count
        
        count += 1