# This program reads a positive integer > 1 and # prints all the primes in the range 1 ... n import math def isPrime(n): if n <= 1: return False sqrtN = int(math.sqrt(n)) for div in range(2,sqrtN+1): if n%div == 0: return False return True def main(): n = input("Enter a +ve integer > 1: ") print "Primes in 1 ...",n,"are", prmC = 0 for m in range(2,n+1): if isPrime(m): prmC = prmC + 1 print m, print "Prime count:", prmC main()