python 求N以内的所有的质数
import sys def isPrime(num): i = 2 while i < num: if 0 == (num%i): return False else: i = i + 1 return True if __name__ == '__main__': iInput = int(raw_input('Assign a number N:')) for j in range(2, iInput + 1): if(isPrime(j)): print j
欢迎访问:wenhao.ink