aboutsummaryrefslogtreecommitdiffstats
path: root/10001prime.py.orig
diff options
context:
space:
mode:
authormjf <mjf@localhost.localdomain>2020-02-04 12:11:30 -0500
committermjf <mjf@localhost.localdomain>2020-02-04 12:11:30 -0500
commit6aa02212cd6dfbb492fa1f70b60a4fe3d48892e5 (patch)
tree1b655714c9709ee8fce333fcb6a6be3f5533b2d3 /10001prime.py.orig
parent8e431d287c0e89041506da4c4da57e3e3d657d72 (diff)
downloadProject_Euler_Solutions-6aa02212cd6dfbb492fa1f70b60a4fe3d48892e5.tar.gz
cleanup and added more c examples:
Diffstat (limited to '10001prime.py.orig')
-rw-r--r--10001prime.py.orig30
1 files changed, 0 insertions, 30 deletions
diff --git a/10001prime.py.orig b/10001prime.py.orig
deleted file mode 100644
index ecaa8cd..0000000
--- a/10001prime.py.orig
+++ /dev/null
@@ -1,30 +0,0 @@
-import PIL, math
-
-#Problem 7 - 10,001st prime
-
-#returns a list of every prime up to a certain number
-def listprimes(number):
- primes = []
- if (number <=1):
- return [1]
- a = [1] * number
- a[0]=0
- a[1]=0#1 and 0 are not prime
- ##Sieve of eratosthenes
- for i in range(2,int(math.ceil(math.sqrt(number)))):
- if(a[i]==1):
- j = i**2 #cross out all the multiples of i, starting with its square
- while(j < number):
- a[j] = 0
- j+=i
-
- for k in range(2, number):
- #is prime
- if(a[k]==1):
- primes.append(k)
- return primes
-
-out_list = listprimes(1000000)
-#print(out_list)
-#return 10,001th prime factor
-print(out_list[10000])