Content deleted Content added
m →Generator Expressions: Fixed misspelled word in description and changed a constant in the example code so it makes sense. |
→Python: make primes run on odds only, test by primes less than sqrt of n only... (check my code please) |
||
Line 58:
# Example use: printing out the integers from 10 to 20.
# Note that this iteration terminates normally, despite
# countfrom() being written as an infinite loop.
for i in countfrom(10):
Line 70:
def primes():
n = 3
p = []
while True:
if not any( n % f == 0 for f in takeWhile(lambda f: f*f <= n, p) ):
yield n
p.append( n )
n +=
</source>
|