Updated to remove a potential bug in the getDivisors function

This commit is contained in:
2019-01-31 12:20:57 -05:00
parent e9fa256b98
commit e4c47129b9

View File

@@ -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()