mpz_millerrabin

Niels Möller nisse at lysator.liu.se
Sat Jan 5 22:37:58 CET 2008


The function mpz_millerrabin seems to be undocumented and marked as
"internal". I want to test primality for numbers where I already know
that there are no small factors, so I'd like to avoid the trial
division work done by mpz_probably_prime_p.

I'm considering simply writing a configure check for the
mpz_millerrabin function, and use it if it is available. I have
difficulty imagining any useful changes to the current interface of
this function,

  int
  mpz_millerrabin (mpz_srcptr n, int reps)

(The interface for mpz_probab_prime_p, on the other hand, is somewhat
fishy, and I think we have been discussing replacing the repetition
argument, which makes sense only if you know the final test is
millerrabin, with some bound for the probability of error).

Another alternative would be to copy GMP's current miller-rabin
function, or write my own, to ensure that it's always available, but
that seems like a waste of time.

/Niels



More information about the gmp-devel mailing list