mirror of
https://bitbucket.org/Mattrixwv/octavefunctions.git
synced 2025-12-07 03:03:57 -05:00
Updated to fix infinite loop and time
This commit is contained in:
@@ -17,6 +17,7 @@ while(~found)
|
|||||||
if(mod(numSum, divCounter) == 0)
|
if(mod(numSum, divCounter) == 0)
|
||||||
numDivisors += 2;
|
numDivisors += 2;
|
||||||
end
|
end
|
||||||
|
++divCounter;
|
||||||
end
|
end
|
||||||
|
|
||||||
%Check if there are enough divisors
|
%Check if there are enough divisors
|
||||||
@@ -33,7 +34,7 @@ endTime = clock();
|
|||||||
number = numSum
|
number = numSum
|
||||||
highestNumber = counter - 1
|
highestNumber = counter - 1
|
||||||
numDivisors = numDivisors
|
numDivisors = numDivisors
|
||||||
totalTime = etime(endTime - startTime)
|
totalTime = etime(endTime, startTime)
|
||||||
|
|
||||||
%Cleanup the variables
|
%Cleanup the variables
|
||||||
clear found;
|
clear found;
|
||||||
@@ -46,3 +47,4 @@ clear endTime;
|
|||||||
clear totalTime;
|
clear totalTime;
|
||||||
clear numDivisors;
|
clear numDivisors;
|
||||||
clear divCounter;
|
clear divCounter;
|
||||||
|
clear ans;
|
||||||
|
|||||||
Reference in New Issue
Block a user