Skip to content

Instantly share code, notes, and snippets.

@dnene
dnene / prime_generator.py
Created July 5, 2011 10:52 — forked from dexterous/prime_generator.py
prime number generator in python
def prime_generator():
yield 2
prev = [2]
potential = 3
while True:
while any(map(lambda x: potential % x == 0, prev)):
potential += 1