Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #решето Эратосфена
- n = int(input())
- a = [1] * (n + 1)
- i = 2
- while i*i <= n:
- if a[i]:
- for j in range(i * i, n + 1, i):
- a[j] = 0
- i += 1
- for i in range(2, n + 1):
- if a[i]:
- print(i, end = ' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement