Fixed some typoes

This commit is contained in:
2021-06-30 18:33:57 -04:00
parent 6ed905fa01
commit 78752e3b90

View File

@@ -31,17 +31,17 @@ def primeGenerator():
#Return 2 the first time, this lets us skip all even numbers later
yield 2
#Map composite integers to primes witnessing their compositeness
#Dictionary to hold the primes we have already found
dict = {}
#Start checking for primes with the number 3 and skip all even numbers
for possiblePrime in itertools.count(3, 2):
#If q is not in the dictionary it is a new prime number
#Return it and mark it's next multiple
#If possiblePrime is not in the dictionary it is a new prime number
#Return it and mark its next multiple
if possiblePrime not in dict:
yield possiblePrime
dict[possiblePrime * possiblePrime] = [possiblePrime]
#If q is in the dictionary it is a composite number
#If possiblePrime is in the dictionary it is a composite number
else:
#Move each witness to it's next multiple
for num in dict[possiblePrime]: