Created
September 29, 2015 17:29
-
-
Save codeadict/050ec5a28a4839f3e5fe to your computer and use it in GitHub Desktop.
Generates a list of prime numbers from 2 to N. Done for a friend homework of MIT edx.
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 primesList(N): | |
""" | |
Generates a list of prime numbers from 2 to N. | |
N: an integer | |
""" | |
return [a for a in range(2, N) if not [b for b in range(2,a) if not a%b]] | |
def __main__(): | |
print primesList(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment