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()
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()