Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math, pickle
- num = int(raw_input('num: '))
- list = range(0,num+1)
- p = 2
- i = 4
- while p <= math.sqrt(num):
- while True:
- try:
- list[i] = 0
- i += p
- except IndexError:
- break
- while True:
- p += 1
- if list[p] != 0:
- break
- i = p+p
- list[1] = 0
- list = [x for x in list if x != 0]
Add Comment
Please, Sign In to add comment