New code for primality testing

Adrien Prost-Boucle adrien.prost-boucle at laposte.net
Tue Nov 20 21:59:19 UTC 2018


Another way at solving the randstate issue with just spec/doc :

> The probabilistic test should take a gmp_randstate_t parameter, so that
> repeated calls to the test can give increasing confidence.

There may be a simpler (and more generic) solution.

The confidence issue can be solved just by exposing the other function
  int millerrabin (mpz_t n, mpz_t a)
that only does one MR test and which is largely already present.
Just say that the user has to generate the random numbers.

And it could be specified that this function
  int mpz_millerrabin (mpz_t n, int reps)
internally takes care of randstate boilerplate, like in current code.
Which adds to its added value and simplicity of use.
Repeated calls may not bring additional confidence,
but it's not important because the number of "calls" can already be set with the reps parameter.

Adrien




More information about the gmp-devel mailing list