找出200-400之间素数的快速算法,python实现
Code
1 def isPrime(number):
2 divisor = 3
3 testLimit = number
4 if number % 2 == 0:
5 return False
6 while testLimit > divisor:
7 if number % divisor == 0:
8 return False
9 testLimit = number / divisor
10 divisor += 2
11 return True
12 if __name__ == "__main__":
13 for i in range(200, 400):
14 if isPrime(i):
15 print i
16
17