I just came up with this. It may not be the fastest, but I'm not using anything other than straight additions and comparisons. Of course, what stops you here is the recursion limit.
def nondivsby2(): j = 1 while True: j += 2 yield jdef nondivsbyk(k, nondivs): j = 0 for i in nondivs: while j < i: j += k if j > i: yield idef primes(): nd = nondivsby2() while True: p = next(nd) nd = nondivsbyk(p, nd) yield pdef main(): for p in primes(): print(p)