-
-
Save mvallebr/c2a14e10d844c21db57dbed51a5cac82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def primes_up_to(N): | |
sieve = N*[True] | |
for i in range(2, N): | |
if not sieve[i]: continue | |
yield i | |
for j in range(i*i, N, i): | |
sieve[j] = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment