SHARE
TWEET

find20primes.py

rdrewd-facebook Sep 27th, 2014 1,366 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. primes=[2]
  2. cand=3
  3. while len(primes) < 20:
  4.     for factor in primes:
  5.         if cand % factor == 0:
  6.             # Not a prime
  7.             break
  8.     else:
  9.        primes.append(cand)
  10.     cand += 2
  11. print primes
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top