mirror of
https://github.com/correl/euler.git
synced 2024-11-27 11:09:54 +00:00
Problem 007
git-svn-id: file:///srv/svn/euler@24 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
82c0ac0672
commit
daa7b36149
1 changed files with 16 additions and 0 deletions
16
007.py
Normal file
16
007.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
def primes(limit):
|
||||
primes = []
|
||||
i = 2
|
||||
while len(primes) < limit:
|
||||
is_prime = True
|
||||
for p in primes:
|
||||
if i % p == 0:
|
||||
is_prime = False
|
||||
break
|
||||
if is_prime:
|
||||
primes.append(i)
|
||||
i = i + 1
|
||||
return primes
|
||||
|
||||
print '6th Prime', primes(6)[-1]
|
||||
print '10001st Prime', primes(10001)[-1]
|
Loading…
Reference in a new issue