Sha256: 690db42b7bc4e9d100646604774383bf313b7d9dc62543beb6ff3240d36697d4

Contents?: true

Size: 281 Bytes

Versions: 396

Compression:

Stored size: 281 Bytes

Contents

def sieve(limit):
    prime = [True] * (limit + 1)
    prime[0] = prime[1] = False
    for i in range(2, int(limit ** 0.5) + 1):
        if prime[i]:
            for j in range(i * i, limit + 1, i):
                prime[j] = False
    return [i for i, x in enumerate(prime) if x]

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/python/exercises/sieve/example.py
trackler-2.2.1.179 tracks/python/exercises/sieve/example.py
trackler-2.2.1.178 tracks/python/exercises/sieve/example.py
trackler-2.2.1.177 tracks/python/exercises/sieve/example.py
trackler-2.2.1.176 tracks/python/exercises/sieve/example.py
trackler-2.2.1.175 tracks/python/exercises/sieve/example.py
trackler-2.2.1.174 tracks/python/exercises/sieve/example.py
trackler-2.2.1.173 tracks/python/exercises/sieve/example.py
trackler-2.2.1.172 tracks/python/exercises/sieve/example.py
trackler-2.2.1.171 tracks/python/exercises/sieve/example.py
trackler-2.2.1.170 tracks/python/exercises/sieve/example.py
trackler-2.2.1.169 tracks/python/exercises/sieve/example.py
trackler-2.2.1.167 tracks/python/exercises/sieve/example.py
trackler-2.2.1.166 tracks/python/exercises/sieve/example.py
trackler-2.2.1.165 tracks/python/exercises/sieve/example.py
trackler-2.2.1.164 tracks/python/exercises/sieve/example.py
trackler-2.2.1.163 tracks/python/exercises/sieve/example.py
trackler-2.2.1.162 tracks/python/exercises/sieve/example.py
trackler-2.2.1.161 tracks/python/exercises/sieve/example.py
trackler-2.2.1.160 tracks/python/exercises/sieve/example.py