This is an example of Inverse Gray iterator (Sloane series A006068) Python2 code from:
http://code.activestate.com/recipes/221457/

def A006068():
    yield 0
    for x in A006068():
        if x & 1:
            yield 2 * x + 1
            yield 2 * x
        else:
            if x:
                yield 2 * x
            yield 2 * x + 1


Does this spawn linear many generators?

Reply via email to