diff --git a/Algorithms.hpp b/Algorithms.hpp index dda606d..548b5e2 100644 --- a/Algorithms.hpp +++ b/Algorithms.hpp @@ -343,7 +343,7 @@ std::vector getAllFib(const T num){ tempNums[0] = tempNums[1] = 1; //Do the calculation and add each number to the vector - for(T cnt = 2;(tempNums[(cnt - 1) % 3] < num) && (tempNums[(cnt - 1) % 3] >= tempNums[(cnt - 2) % 3]);++cnt){ + for(T cnt = 2;(tempNums[(cnt - 1) % 3] <= num) && (tempNums[(cnt - 1) % 3] >= tempNums[(cnt - 2) % 3]);++cnt){ tempNums[cnt % 3] = tempNums[(cnt + 1) % 3] + tempNums[(cnt + 2) % 3]; fibList.push_back(tempNums[cnt % 3]); }