Infinite loop in mpz_probab_prime_p

Torbjorn Granlund tege at swox.com
Fri Mar 4 03:45:40 CET 2005


"Darin Ohashi" <darin242 at hotmail.com> writes:

  >In your case, ln2 will become 96884649.  That's a long loop...!
  >
  
  Indeed.  I guess any large integer that is the product of large primes
  will have this problem.
  
While there was too much dividing, it turns out that most of the
time is spent in the Miller-Rabin code.  You need to be more
patient, you are requesting a really huge computation.

(And the main problem with the division code wasn't that it tried
too many divisors; it was the call to isprime to find primes to
divide by.  I replaced that by sieving in the development code.)

-- 
Torbjörn


More information about the gmp-bugs mailing list