From 36a1436b57c92d6b1c50b541663e28396c94b856 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Fri, 9 Apr 2004 00:23:41 +0200 Subject: 2003-02-20 Kevin Ryde * 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. --- demos/factorize.c | 6 +++--- 1 file 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); -- cgit v1.2.1