mirror of
https://github.com/osmarks/random-stuff
synced 2024-11-08 13:39:53 +00:00
13 lines
317 B
Python
13 lines
317 B
Python
|
class Primes:
|
||
|
def __init__(self, max):
|
||
|
self.internal = range(2,max+1)
|
||
|
|
||
|
def __next__(self):
|
||
|
i = self.internal.__iter__().__next__()
|
||
|
self.internal = filter(lambda n : n % i != 0, self.internal)
|
||
|
return i
|
||
|
|
||
|
def __iter__(self): return self
|
||
|
|
||
|
for i in Primes(100):
|
||
|
print(i)
|