aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-07-16 08:20:11 +0000
committerlloyd <[email protected]>2006-07-16 08:20:11 +0000
commite446213555c13befbd9a4e7e908fcf380e5efc76 (patch)
tree68292127704eb4cc9dfbb128785b46f991860934 /doc
parentf731d5aa28ca07472f10e886615e43ce06f8656d (diff)
Remove a debugging print statement
Change the output to sort the factors, and use ':' instead of '=' so the output exactly matches that of the BSD 'factor' program.
Diffstat (limited to 'doc')
-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";