Skip to content

Instantly share code, notes, and snippets.

@iizukak
Created July 15, 2012 15:29
Show Gist options
  • Select an option

  • Save iizukak/3117446 to your computer and use it in GitHub Desktop.

Select an option

Save iizukak/3117446 to your computer and use it in GitHub Desktop.
project euler problem 7
#project euler problem 7
#auther @iizukak
def sieve(n):
primes = []
table = [0 for i in range(n+1)]
for i in range(2, n+1):
if table[i] == 0:
primes.append(i)
j = 2
while(i * j <= n):
table[i * j] = table[i * j] + 1
j = j + 1
return primes
primes = sieve(200000)
print primes[10000]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment