diff --git a/headers/Problems/Problem27.hpp b/headers/Problems/Problem27.hpp index 3a7c057..92c5f1d 100644 --- a/headers/Problems/Problem27.hpp +++ b/headers/Problems/Problem27.hpp @@ -56,7 +56,7 @@ public: The greatest number of primes found is 70 It was found with A = -61, B = 971 The product of A and B is -59231 -It took an average of 2.176 seconds to run this problem over 100 iterations +It took an average of 14.261 milliseconds to run this problem over 100 iterations */ #endif //PROBLEM27_HPP diff --git a/headers/benchmark.hpp b/headers/benchmark.hpp index d9bd5ff..2b546b0 100644 --- a/headers/benchmark.hpp +++ b/headers/benchmark.hpp @@ -42,7 +42,7 @@ std::string getBenchmarkResults(Problem* problem, double totalTime, unsigned int //Variables //Valid menu options enum BENCHMARK_OPTIONS {RUN_SPECIFIC = 1, RUN_ALL_SHORT, RUN_ALL, BENCHMARK_EXIT, BENCHMARK_SIZE}; -std::vector tooLong = {5, 15, 23, 24, 27, 29}; //The list of problems that take "too long" to run. (Over 1 second on my machine) +std::vector tooLong = {5, 15, 23, 24, 29}; //The list of problems that take "too long" to run. (Over 1 second on my machine) //The driver function for the benchmark selection diff --git a/src/Problems/Problem27.cpp b/src/Problems/Problem27.cpp index ef569d0..a5b58df 100644 --- a/src/Problems/Problem27.cpp +++ b/src/Problems/Problem27.cpp @@ -43,8 +43,6 @@ void Problem27::solve(){ //Start the timer timer.start(); - primes = mee::getPrimes((int64_t)(12000)); - //Start with the lowest possible A and check all possibilities after that for(int64_t a = -999;a <= 999;++a){ //Start with the lowest possible B and check all possibilities after that @@ -52,7 +50,7 @@ void Problem27::solve(){ //Start with n=0 and check the formula to see how many primes you can get with concecutive n's int64_t n = 0; int64_t quadratic = (n * n) + (a * n) + b; - while(mee::isFound(primes, quadratic)){ + while(mee::isPrime(quadratic)){ ++n; quadratic = (n * n) + (a * n) + b; }