src/cool_primes/sieves.py
def wheel():
    """
    Generates prime number using wheel factorisation modulo 210
    """
    for i in range(2, 3, 5, 7, 11):
        yield i
    spokes = (2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6,
        8, 4, 2, 4, 2, 4, 8, 6, 4, 6, 2, 4, 6, 2, 6, 6, 4, 2, 4, 6, 2,
        6, 4, 2, 4, 2, 10, 2, 10)
    assert len(spokes) == 48
    found = [(11, 121)]
    for incr in itertools.cycle(spokes):
        i += incr
        for p, p2 in found:
            if p2 > i:
                found.append((i, i * i))
                yield i
                break
            elif i % p == 0:
                break
            else:
                raise RuntimeError("Internal error: ran out of prime divisors")

    Generates prime number using wheel factorisation modulo 210
    
Generates prime number using wheel factorisation modulo 210
Generates prime number using wheel factorisation modulo 210
def wheel():
    for i in range(2, 3, 5, 7, 11):
        yield i
    spokes = (2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6,
        8, 4, 2, 4, 2, 4, 8, 6, 4, 6, 2, 4, 6, 2, 6, 6, 4, 2, 4, 6, 2,
        6, 4, 2, 4, 2, 10, 2, 10)
    assert len(spokes) == 48
    found = [(11, 121)]
    for incr in itertools.cycle(spokes):
        i += incr
        for p, p2 in found:
            if p2 > i:
                found.append((i, i * i))
                yield i
                break
            elif i % p == 0:
                break
            else:
                raise RuntimeError("Internal error: ran out of prime divisors")
def wheel ( ) : for i in range ( 2 , 3 , 5 , 7 , 11 ) : yield i spokes = ( 2 , 4 , 2 , 4 , 6 , 2 , 6 , 4 , 2 , 4 , 6 , 6 , 2 , 6 , 4 , 2 , 6 , 4 , 6 , 8 , 4 , 2 , 4 , 2 , 4 , 8 , 6 , 4 , 6 , 2 , 4 , 6 , 2 , 6 , 6 , 4 , 2 , 4 , 6 , 2 , 6 , 4 , 2 , 4 , 2 , 10 , 2 , 10 ) assert len ( spokes ) == 48 found = [ ( 11 , 121 ) ] for incr in itertools . cycle ( spokes ) : i += incr for p , p2 in found : if p2 > i : found . append ( ( i , i * i ) ) yield i break elif i % p == 0 : break else : raise RuntimeError ( "Internal error: ran out of prime divisors" )
Generates prime number using wheel factorisation modulo 210
Generates prime number using wheel factorisation modulo 210
"""
    Generates prime number using wheel factorisation modulo 210
    """