Created
April 12, 2010 22:25
-
-
Save shiumachi/364067 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
#!/usr/bin/python | |
# print prime number between 2 - N with re module, where N is argv[1] | |
# very very slow | |
import sys,re | |
r = re.compile('^(..+)\\1+$') | |
N = int(sys.argv[1]) | |
for i in xrange(2,N): | |
if not r.match('x' * i): | |
print i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment