Updated fibGenerator

This commit is contained in:
2020-10-30 15:29:17 -04:00
parent da0ae679b7
commit 22feed5147

View File

@@ -52,12 +52,13 @@ def primeGenerator():
#Skip all multiples of 2
possiblePrime += 2
#Generate an inifinite sequence of fibonacci numbers
def fibGenerator():
#The first and second fibonacci numbers are 1 and 1
a, b = 1, 1
#Set this so the first returned number is 1 and the second is also 1
a, b = 0, 1
while(True):
yield a
yield b
a, b = b, a + b
#This function returns a list with all the prime numbers <= goalNumber