summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2004-04-09 00:23:41 +0200
committerKevin Ryde <user42@zip.com.au>2004-04-09 00:23:41 +0200
commit36a1436b57c92d6b1c50b541663e28396c94b856 (patch)
tree5a008a65ce0d2c2704f27e8067860a674ee4dd16
parentd024a305ef7bae0e84fbae558381589ab8006b34 (diff)
downloadgmp-36a1436b57c92d6b1c50b541663e28396c94b856.tar.gz
2003-02-20 Kevin Ryde <kevin@swox.se>
* demos/factorize.c (factor_using_pollard_rho): Test k>0 to avoid infinite loop if k=0 and gcd!=1 reveals a factor. Reported by John Pongsajapan.
-rw-r--r--demos/factorize.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/demos/factorize.c b/demos/factorize.c
index fcee6d1ab..d02c6e614 100644
--- a/demos/factorize.c
+++ b/demos/factorize.c
@@ -1,7 +1,7 @@
/* Factoring with Pollard's rho method.
-Copyright 1995, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+Foundation, Inc.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -180,7 +180,7 @@ S2:
}
S3:
k--;
- if (k != 0)
+ if (k > 0)
goto S2;
mpz_gcd (g, P, n);