Skip to content

Instantly share code, notes, and snippets.

@ikasamah
Created July 6, 2011 06:25
Show Gist options
  • Save ikasamah/1066676 to your computer and use it in GitHub Desktop.
Save ikasamah/1066676 to your computer and use it in GitHub Desktop.
prime
# -*- 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