mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-06 17:13:59 -05:00
Added a benchmark tool
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user