Created
May 27, 2022 15:24
-
-
Save Wqrld/94b5c63638ea69f52eb0d314dae5dd07 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
arr = {} | |
def main(): | |
print("Range: ") | |
r = int(input()) | |
# For each number 0-r | |
# If number not yet marked off | |
# mark all multiples of the number that are under r | |
for i in range(2, r): | |
if i not in arr: | |
x = 2 | |
while i * x < r: | |
arr[i * x] = True | |
x = x + 1 | |
# Print out our primes | |
for i in range(2, r): | |
if i not in arr: | |
print(i) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment