diff --git a/Algorithms.py b/Algorithms.py index c63be09..b04fcd8 100644 --- a/Algorithms.py +++ b/Algorithms.py @@ -139,7 +139,9 @@ def getDivisors(goalNumber: int) -> list: #If you find one add it and the number it creates to the list if((goalNumber % possibleDivisor) == 0): divisors.append(possibleDivisor) - divisors.append(goalNumber / possibleDivisor) + #Account for the possibility sqrt(goalNumber) being a divisor + if(possibleDivisor != topPossibleDivisor): + divisors.append(goalNumber / possibleDivisor) #Sort the list before returning for neatness divisors.sort()