def func(): for i in range(2,1000): # count表示被整除的次数 count = 0 for j in range(1,i+1): if i%j==0: count+=1 # count==2说明,该数字只能被1和它本身整除 if count==2: if i==j: print(i) func()
原文地址:https://www.cnblogs.com/lxmtx/p/11840130.html
时间: 2024-11-13 09:56:50
def func(): for i in range(2,1000): # count表示被整除的次数 count = 0 for j in range(1,i+1): if i%j==0: count+=1 # count==2说明,该数字只能被1和它本身整除 if count==2: if i==j: print(i) func()
原文地址:https://www.cnblogs.com/lxmtx/p/11840130.html