Below is a python program I found to find prime numbers using Sieve of Eratosthenes. It uses filter and generator. I'm not able to understand it.
def _odd_iter(): n = 1 while True: n = n + 2 yield ndef _not_divisible(n): return lambda x: x % n > 0def primes(): yield 2 it = _odd_iter() while True: n = next(it) yield n it = filter(_not_divisible(n), it)for n in primes(): if n < 1000: print(n) else: break
What I don't understand is it = filter(_not_divisible(n), it)
. For example for number 105, how is it excluded by this single line of code?