diff --git a/Algorithms.py b/Algorithms.py index cd9313a..67a9d70 100644 --- a/Algorithms.py +++ b/Algorithms.py @@ -143,14 +143,11 @@ def getDivisors(goalNumber: int) -> list: #If the number is 1 return just itself elif(goalNumber == 1): divisors.append(1) - #Otherwise add 1 and itself to the list - else: - divisors.append(1) - divisors.append(goalNumber) + return divisors #Start at 3 and loop through all numbers < (goalNumber / 2 ) looking for a number that divides it evenly topPossibleDivisor = math.ceil(math.sqrt(goalNumber)) - possibleDivisor = 2 + possibleDivisor = 1 while(possibleDivisor <= topPossibleDivisor): #If you find one add it and the number it creates to the list if((goalNumber % possibleDivisor) == 0):