New mpz prp functions...

David Cleaver wraithx at morpheus.net
Tue Aug 9 03:08:12 CEST 2011


Hello all,

Along with the previous Lucas functions I've mentioned, I'd also like to propose 
that we add several new prp functions to the official GMP library.  Here are the 
prototypes for the new prp functions:

int mpz_prp(mpz_t n, mpz_t a) aka: Fermat pseudoprime
int mpz_euler_prp(mpz_t n, mpz_t a) aka: Solovay-Strassen pseudoprime
int mpz_sprp(mpz_t n, mpz_t a) aka: Miller-Rabin pseudoprime
int mpz_fibonacci_prp(mpz_t n, long int p, long int q)
int mpz_lucas_prp(mpz_t n, long int p, long int q)
int mpz_stronglucas_prp(mpz_t n, long int p, long int q)
int mpz_extrastronglucas_prp(mpz_t n, long int p)
int mpz_selfridge_prp(mpz_t n) aka: Lucas-Selfridge pseudoprime
int mpz_strongselfridge_prp(mpz_t n) aka: strong Lucas-Selfridge pseudoprime
int mpz_bpsw_prp(mpz_t n)
int mpz_strongbpsw_prp(mpz_t n)

Where each function can return one of:
#define PRP_ERROR -1
#define PRP_COMPOSITE 0
#define PRP_PRP 1
#define PRP_PRIME 2

You can download the code at the sourceforge site:
http://sourceforge.net/projects/mpzprp/files/

The source is licensed under the LGPL and includes a sample main() function that 
will print the result of each test for a list of 25 numbers, starting with one 
given on the command line.

Again I'd like to ask, is there any formal procedure to ask for new functions to 
be included into GMP?

-David C.


More information about the gmp-discuss mailing list