diff --git a/sy5-3.py b/sy5-3.py deleted file mode 100644 index f187490..0000000 --- a/sy5-3.py +++ /dev/null @@ -1,19 +0,0 @@ -from math import sqrt -def isPrime(n): - m=int(sqrt(n)) - for i in range(2,m+1): - if n%i ==0: - return False - return True -def countPrimes(start,end): - cnt=0 - for i in range(start,end+1): - if(isPrime(i)): - cnt+=1; - - return cnt - -#主程序 -for start in range(1,1000,100): - print("%3d-%4d 有%d个素数"%\ - (start,start+99,countPrimes(start,start+99)))