From 13ee965026337d202b93fde29ab5e474440c9fe6 Mon Sep 17 00:00:00 2001 From: pudepiedj Date: Fri, 8 Mar 2024 09:31:09 +0000 Subject: [PATCH] Carmichael revision --- examples/cmap-example/Carmichael.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/cmap-example/Carmichael.cpp b/examples/cmap-example/Carmichael.cpp index cdbf1781b..eb2f60260 100644 --- a/examples/cmap-example/Carmichael.cpp +++ b/examples/cmap-example/Carmichael.cpp @@ -38,6 +38,7 @@ static void print_factors(vector factors) { static bool is_prime(size_t n) { + bool is_prime = true; for (size_t j = 3; j * j <= n; j += 2) { if (n % j == 0) { @@ -45,6 +46,7 @@ static bool is_prime(size_t n) { break; } } + return is_prime; } @@ -68,7 +70,7 @@ static bool is_carmichael(size_t n) { } } print_factors(factors); - cout << " = " << n << endl;; + cout << " = " << n << " with " << factors.size() << " prime factors." << endl;; return true; }