summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2004-04-12 01:13:16 +0200
committerKevin Ryde <user42@zip.com.au>2004-04-12 01:13:16 +0200
commit45fcb530a22d891110148841ec84d0c217aae27b (patch)
treee0190647d66ec789459e94ac475244c8ae1fc947 /demos
parent7bb8696079bcab9e75df11896286ae973412cf58 (diff)
downloadgmp-45fcb530a22d891110148841ec84d0c217aae27b.tar.gz
(This somehow never got checked-in sooner.)
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.
Diffstat (limited to 'demos')
-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);