bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in factorize.c (in the demos folder)


From: Paul Zimmermann
Subject: Re: Bug in factorize.c (in the demos folder)
Date: Mon, 24 Nov 2003 09:41:04 +0100

   To fix this, I changed the "if (k != 0)" statement to 
   "if(k > 0)", which seems to work. The correct output for the input 
   above is

   2 2 2 2 3 3 3 7 7 7 113 197 271 421 49633 1117913 16700713 704628237289

   My solution should be reviewed by someone who knows the theory to make 
   sure it always works (and if not to find the right one!)

   Regards,
   Phil McLaughlin

I think a better fix would be:

S3:
      if (k)
        {
          k--;
          goto S2;
        }

since then k is never decremented from 0 to a huge value, and since
k is reset when we go to the gcd, no need to decrement it. In that
case, we probably want to change the initialization to k=0, so the
loop is performed only once at the beginning.

Paul Zimmermann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]