就当为CSDN这方面的python开源做点贡献哈哈哈 素性检验(Eratosthenes筛选法) 算法原理 python代码 #素数检验 def PrimalityTest(n:int): m=n p=2 while p<m**0.5: if m%p==0: m/=p else:p+=1 if m==n: return True elif m>1: return False 实现过程