Skip to content

Instantly share code, notes, and snippets.

@CCCougar
Last active November 28, 2021 08:46
Show Gist options
  • Save CCCougar/871b7519076a3da175fe88fab68864ac to your computer and use it in GitHub Desktop.
Save CCCougar/871b7519076a3da175fe88fab68864ac to your computer and use it in GitHub Desktop.
Eratosthenes sieve
def Era(number):
pres_num = int(number ** 0.5)
for i in range(1, pres_num):
if Divide(number, i+1):
return True
return False
def Divide(number, factor):
if number % factor == 0:
return True
else:
return False
for i in range(1, 20):
print(i, str(Era(i)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment