Advertisement
Joeytje50

PRIMZ

Dec 7th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. def plist(max_n):
  2.     primes = [2]
  3.     for i in xrange(3,max_n+1,2):
  4.         for n in primes:
  5.             if i%n==0:
  6.                 break
  7.         else:
  8.             primes.append(i)
  9.     return primes
  10. print plist(3572)
  11. print len(plist(3572))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement