From 22feed51475046cc0bcf131d2476a1048645790a Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Fri, 30 Oct 2020 15:29:17 -0400 Subject: [PATCH] Updated fibGenerator --- Algorithms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Algorithms.py b/Algorithms.py index 6cfdc62..26fa100 100644 --- a/Algorithms.py +++ b/Algorithms.py @@ -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