Created
November 4, 2013 01:35
-
-
Save hamukazu/7296844 to your computer and use it in GitHub Desktop.
To show the number of 6 digit prime numbers
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
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