Skip to content

Instantly share code, notes, and snippets.

@hamukazu
Created November 4, 2013 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamukazu/7296844 to your computer and use it in GitHub Desktop.
Save hamukazu/7296844 to your computer and use it in GitHub Desktop.
To show the number of 6 digit prime numbers
ps=[]
def pre():
f=[True]*1000
for i in xrange(2,1000):
if f[i]:
ps.append(i)
j=i
while j<1000:
f[j]=False
j+=i
def p(n):
for m in ps:
if n%m==0:
return False
return True
def main():
pre()
count=0
for i in xrange(100000,1000000):
if p(i):
count+=1
print count
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment