Created
July 15, 2012 15:29
-
-
Save iizukak/3117446 to your computer and use it in GitHub Desktop.
project euler problem 7
This file contains hidden or 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
| #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