From 7af573545190eb3926cd91d7092eeb71f3128bfb Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Thu, 27 Sep 2018 13:33:27 -0400 Subject: [PATCH] Updated to run faster --- ProjectEuler/C++/Problem12.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ProjectEuler/C++/Problem12.cpp b/ProjectEuler/C++/Problem12.cpp index 2436a81..30ab552 100644 --- a/ProjectEuler/C++/Problem12.cpp +++ b/ProjectEuler/C++/Problem12.cpp @@ -6,7 +6,6 @@ #include -#include //For fmod #include //For the timer @@ -50,7 +49,7 @@ unsigned long countDivisors(unsigned long number){ for(int cnt = 1;cnt * cnt < number;++cnt){ //Check if the counter evenly divides the number //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; } }