Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- startingPrimes = [2,3, 5, 7, 11, 13, 17, 19]
- for times in range (2):
- primeList = []
- numbersToBeTested = 0
- for _ in range (startingPrimes[len(startingPrimes)-1]**2):
- primeList.append(_ + 2)
- print ()
- numbersToBeTested = startingPrimes[len(startingPrimes)-1]**2
- print (numbersToBeTested)
- divisor = 0
- term = 0
- dividend = 0
- position = 0
- while divisor < math.sqrt(len(primeList)):
- term = 0
- divisor = startingPrimes[position]
- dividend = primeList[position]
- while term + 1 < len(primeList):
- term = term + 1
- if primeList[term] % divisor == 0:
- if primeList[term] != divisor:
- primeList.remove(primeList[term])
- position = position + 1
- startingPrimes = primeList
- for termOfList in range (len(primeList)):
- print (primeList[termOfList])
- print ("How many primes: " + str(len(primeList)))
- print ("10001st prime: " + str(primeList[10000]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement