Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
#prime number generator
import math
def is_prime(n):
if n == 1:
return False
if n == 2:
return True
if n > 2 and n % 2 == 0:
return False
for i in range(2, n):
if n % i == 0:
return False
return True
for y in range (1, 100000):
if is_prime(y) == True:
print (y)
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more