Added descriptions to problems that didn't have any

This commit is contained in:
2020-06-06 18:17:13 -04:00
parent a841942741
commit 0f6f4fe0be
4 changed files with 18 additions and 18 deletions

View File

@@ -28,7 +28,7 @@
#include "../Headers/Problem27.hpp" #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; topA = topB = topN = 0;
primes = mee::getPrimes((int64_t)(12000)); primes = mee::getPrimes((int64_t)(12000));
} }

View File

@@ -29,6 +29,17 @@
#include "../Headers/Problem28.hpp" #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 //Sets up the grid
void Problem28::setupGrid(){ void Problem28::setupGrid(){
bool finalLocation = false; //A flag to indicate if the final location to be filled has been reached 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(){ void Problem28::solve(){
//If the problem has already been solved do nothing and end the function //If the problem has already been solved do nothing and end the function
if(solved){ if(solved){

View File

@@ -34,7 +34,7 @@
#include "Algorithms.hpp" #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?"){
} }

View File

@@ -30,6 +30,10 @@
#include "../Headers/Problem30.hpp" #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 //Returns a vector with the indivitual digits of the number passed into it
std::vector<uint64_t> Problem30::getDigits(uint64_t num){ std::vector<uint64_t> Problem30::getDigits(uint64_t num){
std::vector<uint64_t> listOfDigits; //This vector holds the individual digits of num std::vector<uint64_t> listOfDigits; //This vector holds the individual digits of num
@@ -43,10 +47,6 @@ std::vector<uint64_t> Problem30::getDigits(uint64_t num){
return listOfDigits; return listOfDigits;
} }
Problem30::Problem30(){
}
void Problem30::solve(){ void Problem30::solve(){
//If the problem has already been solved do nothing and end the function //If the problem has already been solved do nothing and end the function
if(solved){ if(solved){