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