Risonna

Решето Эратосфена

Jul 10th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. N = 121
  2. simple = [True]*(N+1)
  3. for x in range(2, int(N**0.5) + 1):
  4.     if simple[x]:
  5.         y = x*x
  6.         while y <= N:
  7.             simple[y] = False
  8.             y += x
  9. for x in range(2, N):
  10.     if simple[x]:
  11.         print(x, end=' ')
  12. print()
Advertisement
Add Comment
Please, Sign In to add comment