Skip to content

Instantly share code, notes, and snippets.

@goz
Created June 1, 2010 21:36
Show Gist options
  • Select an option

  • Save goz/421534 to your computer and use it in GitHub Desktop.

Select an option

Save goz/421534 to your computer and use it in GitHub Desktop.
def prime_number(n):
n = int(n)
primelist=[]
markedlist=[False]*(n+1)
for i in range(2,n+1):
if not markedlist[i]:
primelist.append(i)
for m in range(i**2, n+1, i):
markedlist[m] = True
return primelist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment