Created
February 10, 2015 04:14
-
-
Save ssanin82/09214d2216a79e87f09a 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 get_primes_under(n): | |
primes = list() | |
sieve = [0] * (n + 1) | |
for i in xrange(2, n): | |
if not sieve[i]: | |
primes.append(i) | |
for j in xrange(i + i, n, i): | |
sieve[j] = 1 | |
return primes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment