Added a benchmark tool

This commit is contained in:
2020-07-08 20:38:37 -04:00
parent a7d960c3b1
commit 766af92f1a
68 changed files with 546 additions and 134 deletions

View File

@@ -30,7 +30,6 @@
Problem27::Problem27() : Problem("Considering quadratics of the form n^2 + an + b, where |a| < 1000 and |b| <= 1000, find the product of the coefficients a and b that produce the maximum number of primes for consecutive values of n starting with n = 0."){
topA = topB = topN = 0;
primes = mee::getPrimes((int64_t)(12000));
}
void Problem27::solve(){
@@ -42,6 +41,8 @@ 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
@@ -108,3 +109,9 @@ int64_t Problem27::getTopN() const{
}
return topN;
}
void Problem27::reset(){
Problem::reset();
topA = topB = topN = 0;
primes.clear();
}