From daa7b361496e4b9169488dc35c3eeede05fa4e83 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 12 Apr 2010 15:53:04 +0000 Subject: [PATCH] Problem 007 git-svn-id: file:///srv/svn/euler@24 e5f4c3ec-3c0c-11df-b522-21efaa4426b5 --- 007.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 007.py diff --git a/007.py b/007.py new file mode 100644 index 0000000..bba77f7 --- /dev/null +++ b/007.py @@ -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]