Guest User

Untitled

a guest
Dec 18th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. def first_n_primes(n):
  2.     primes = []
  3.     i = 2
  4.     while len(primes) < n:
  5.         if any(i % p == 0 for p in primes):
  6.             i += 1
  7.             continue
  8.         primes.append(i)
  9.         i += 1
  10.     return primes
Advertisement
Add Comment
Please, Sign In to add comment