mirror of
https://bitbucket.org/Mattrixwv/octavefunctions.git
synced 2026-02-03 19:52:31 -05:00
Updated to run faster
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath> //For fmod
|
|
||||||
#include <chrono> //For the timer
|
#include <chrono> //For the timer
|
||||||
|
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ unsigned long countDivisors(unsigned long number){
|
|||||||
for(int cnt = 1;cnt * cnt < number;++cnt){
|
for(int cnt = 1;cnt * cnt < number;++cnt){
|
||||||
//Check if the counter evenly divides the number
|
//Check if the counter evenly divides the number
|
||||||
//If it does the counter and the other number are both divisors
|
//If it does the counter and the other number are both divisors
|
||||||
if(fmod((double)number, (double)cnt) == 0){
|
if((number % cnt) == 0){
|
||||||
numDivisors += 2;
|
numDivisors += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user