Skip to content

Instantly share code, notes, and snippets.

@shiumachi
Created April 12, 2010 22:25
Show Gist options
  • Save shiumachi/364067 to your computer and use it in GitHub Desktop.
Save shiumachi/364067 to your computer and use it in GitHub Desktop.
#!/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