Created
July 6, 2011 06:25
-
-
Save ikasamah/1066676 to your computer and use it in GitHub Desktop.
prime
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
# -*- coding: utf-8 -*- | |
import math | |
def is_prime(n): | |
for i in xrange(2, int(math.sqrt(n)) + 1): | |
if not n % i: | |
return False | |
return True | |
def main(): | |
return [i for i in xrange(2, 101) if is_prime(i)] | |
if __name__ == '__main__': | |
print main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment