Skip to content

Instantly share code, notes, and snippets.

@imom0
Created October 6, 2012 09:18
Show Gist options
  • Save imom0/3844464 to your computer and use it in GitHub Desktop.
Save imom0/3844464 to your computer and use it in GitHub Desktop.
prime generator
def prime_generator():
_primes = [2]
current = 3
while True:
if all(current % prime != 0 for prime in _primes):
_primes.append(current)
yield current
current += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment