Jump to content

Primes whose sum of digits is 25: Difference between revisions

m
Minor edit to C++ code
(Added C++ solution)
m (Minor edit to C++ code)
Line 98:
}
 
void countAllcount_all(const std::string& str, int rem, int& count) {
if (rem == 0) {
switch (str.back()) {
Line 113:
} else {
for (int i = 1; i <= std::min(9, rem); ++i)
countAllcount_all(str + std::to_string(i), rem - i, count);
}
}
Line 132:
count = 0;
auto start = std::chrono::steady_clock::now();
countAllcount_all("", 25, count);
auto end = std::chrono::steady_clock::now();
std::cout << "\nThere are " << count
1,777

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.