diff --git a/headers/Problems/Problem1.hpp b/headers/Problems/Problem1.hpp index 5abbaed..08b0fdc 100644 --- a/headers/Problems/Problem1.hpp +++ b/headers/Problems/Problem1.hpp @@ -1,7 +1,7 @@ //ProjectEuler/ProjectEulerCPP/headers/Problems/Problem1.hpp //Matthew Ellison // Created: 09-28-18 -//Modified: 08-28-20 +//Modified: 10-26-20 //What is the sum of all the multiples of 3 or 5 that are less than 1000 //Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses /* diff --git a/src/Problems/Problem1.cpp b/src/Problems/Problem1.cpp index fcfb6bb..1a14965 100644 --- a/src/Problems/Problem1.cpp +++ b/src/Problems/Problem1.cpp @@ -1,7 +1,7 @@ //ProjectEuler/ProjectEulerCPP/Source/Problem1.cpp //Matthew Ellison // Created: 07-10-19 -//Modified: 08-28-20 +//Modified: 10-26-20 //What is the sum of all the multiples of 3 or 5 that are less than 1000 //Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses /* @@ -37,6 +37,7 @@ uint64_t Problem1::MAX_NUMBER = 999; Problem1::Problem1() : Problem("What is the sum of all the multiples of 3 or 5 that are less than 1000?"), fullSum(0){ } +//Gets the sum of the progression of the multiple uint64_t Problem1::sumOfProgression(uint64_t multiple){ uint64_t numTerms = std::floor(MAX_NUMBER / multiple); //This gets the number of multiples of a particular number that is < MAX_NUMBER //The sum of progression formula is (n / 2)(a + l). n = number of terms, a = multiple, l = last term