mirror of
https://bitbucket.org/Mattrixwv/pyclasses.git
synced 2025-12-06 18:33:58 -05:00
Fixed some typoes
This commit is contained in:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user