diff --git a/Source/Problem27.cpp b/Source/Problem27.cpp index 5783cf5..7027e3f 100644 --- a/Source/Problem27.cpp +++ b/Source/Problem27.cpp @@ -28,7 +28,7 @@ #include "../Headers/Problem27.hpp" -Problem27::Problem27(){ +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)); } diff --git a/Source/Problem28.cpp b/Source/Problem28.cpp index 50bb0ff..9569b44 100644 --- a/Source/Problem28.cpp +++ b/Source/Problem28.cpp @@ -29,6 +29,17 @@ #include "../Headers/Problem28.hpp" +Problem28::Problem28() : Problem("What is the sum of the number on the diagonals in a 1001 x 1001 spiral formed by starting with the number 1 and moving to the right in a clockwise direction?"){ + //Set the size of the grid to 1001 x 1001 + for(int cnt = 0;cnt < 1001;++cnt){ + grid.emplace_back(); + for(int location = 0;location < 1001;++location){ + grid.at(cnt).push_back(0); + } + } + sumOfDiagonals = 0; +} + //Sets up the grid void Problem28::setupGrid(){ bool finalLocation = false; //A flag to indicate if the final location to be filled has been reached @@ -95,17 +106,6 @@ void Problem28::findSum(){ } } -Problem28::Problem28(){ - //Set the size of the grid to 1001 x 1001 - for(int cnt = 0;cnt < 1001;++cnt){ - grid.emplace_back(); - for(int location = 0;location < 1001;++location){ - grid.at(cnt).push_back(0); - } - } - sumOfDiagonals = 0; -} - void Problem28::solve(){ //If the problem has already been solved do nothing and end the function if(solved){ diff --git a/Source/Problem29.cpp b/Source/Problem29.cpp index d903c32..d210f80 100644 --- a/Source/Problem29.cpp +++ b/Source/Problem29.cpp @@ -34,8 +34,8 @@ #include "Algorithms.hpp" -Problem29::Problem29(){ - +Problem29::Problem29() : Problem("How many distict terms are in the sequence generated by a^b for 2 <= a <= 100 and 2 <= b <= 100?"){ + } void Problem29::solve(){ diff --git a/Source/Problem30.cpp b/Source/Problem30.cpp index 3b97808..fd7bdf6 100644 --- a/Source/Problem30.cpp +++ b/Source/Problem30.cpp @@ -30,6 +30,10 @@ #include "../Headers/Problem30.hpp" +Problem30::Problem30() : Problem("Find the sum of all the numbers that can be written as a sum of the fifth powers of their digits"){ + +} + //Returns a vector with the indivitual digits of the number passed into it std::vector Problem30::getDigits(uint64_t num){ std::vector listOfDigits; //This vector holds the individual digits of num @@ -43,10 +47,6 @@ std::vector Problem30::getDigits(uint64_t num){ return listOfDigits; } -Problem30::Problem30(){ - -} - void Problem30::solve(){ //If the problem has already been solved do nothing and end the function if(solved){