Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def primz(max_n):
- primes = range(2,max_n+1)
- index = 0
- while index < len(primes):
- curnum = primes[index]
- primes = sorted(set(primes) - set(range(curnum*2,max_n+1,curnum)))
- index += 1
- return sorted(primes)
- print primz(1000)
- print len(primz(1000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement