aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/examples/factor.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/examples/factor.cpp b/doc/examples/factor.cpp
index f7b085b86..1855c8ad2 100644
--- a/doc/examples/factor.cpp
+++ b/doc/examples/factor.cpp
@@ -67,10 +67,7 @@ std::vector<BigInt> factorize(const BigInt& n)
BigInt factor = 0;
while(factor == 0)
- {
- std::cout << "Trying to factorize " << n << "\n";
factor = rho(n);
- }
concat(factors, factorize(factor));
concat(factors, factorize(n / factor));
@@ -94,7 +91,9 @@ int main(int argc, char* argv[])
BigInt n(argv[1]);
std::vector<BigInt> factors = factorize(n);
- std::cout << n << " = ";
+ std::sort(factors.begin(), factors.end());
+
+ std::cout << n << ": ";
for(u32bit j = 0; j != factors.size(); j++)
std::cout << factors[j] << " ";
std::cout << "\n";