From 649fe3a66e98d65aa1be70c29a2c398c1bc18f2c Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Sat, 9 Feb 2019 00:20:10 -0500 Subject: [PATCH] Fixed another bug in the getDivisors function --- Algorithms.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Algorithms.hpp b/Algorithms.hpp index ff01ef0..519125d 100644 --- a/Algorithms.hpp +++ b/Algorithms.hpp @@ -221,6 +221,10 @@ std::vector getDivisors(T num){ if(possibleDivisor != topPossibleDivisor){ divisors.push_back(num / possibleDivisor); } + //Take care of a few occations where a number was added twice + if(divisors.at(divisors.size() - 1) == (possibleDivisor + 1)){ + ++possibleDivisor; + } } } //Sort the vector for neatness