从其他论坛看到,非原创,原创者看到请联系我
def get(num):#素数算法
if num == 2 or num == 3:
return True
if num%6 != 1 and num%6 != 5:
return False
tps = int(num**0.5)
for i in range(5,tps+1,6):
if num%i == 0 or num%(i+2) == 0:
return False
return True