Last active
November 28, 2021 08:46
-
-
Save CCCougar/871b7519076a3da175fe88fab68864ac to your computer and use it in GitHub Desktop.
Eratosthenes sieve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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