1 #ifndef MPU_GMPPRIMALITY_H 2 #define MPU_GMPPRIMALITY_H 3 4 #include <gmp.h> 5 #include "ptypes.h" 6 7 extern int is_pseudoprime(mpz_t n, mpz_t a); 8 extern int is_euler_pseudoprime(mpz_t n, mpz_t a); 9 10 extern int miller_rabin(mpz_t n, mpz_t a); 11 extern int miller_rabin_ui(mpz_t n, unsigned long a); 12 extern int miller_rabin_random(mpz_t n, UV numbases, char* seedstr); 13 14 extern int _GMP_is_lucas_pseudoprime(mpz_t n, int strength); 15 extern int _GMP_is_almost_extra_strong_lucas_pseudoprime(mpz_t n, UV incr); 16 extern int _GMP_is_frobenius_underwood_pseudoprime(mpz_t n); 17 extern int _GMP_is_frobenius_khashin_pseudoprime(mpz_t n); 18 extern int is_perrin_pseudoprime(mpz_t n, int restricted); 19 extern int is_euler_plumb_pseudoprime(mpz_t n); 20 extern int is_frobenius_pseudoprime(mpz_t n, IV P, IV Q); 21 extern int is_frobenius_cp_pseudoprime(mpz_t n, UV ntests); 22 23 extern void lucas_seq(mpz_t U, mpz_t V, mpz_t n, IV P, IV Q, mpz_t k, 24 mpz_t Qk, mpz_t t); 25 extern void alt_lucas_seq(mpz_t U, mpz_t V, mpz_t n, IV P, IV Q, mpz_t k, 26 mpz_t Qk, mpz_t t); 27 extern void lucasuv(mpz_t Uh, mpz_t Vl, IV P, IV Q, mpz_t k); 28 extern int lucas_lehmer(UV p); 29 extern int llr(mpz_t N); 30 extern int proth(mpz_t N); 31 extern int is_proth_form(mpz_t N); 32 33 extern int _GMP_BPSW(mpz_t n); 34 extern int is_deterministic_miller_rabin_prime(mpz_t n); /* assumes n is BPSW */ 35 extern int is_miller_prime(mpz_t n, int assume_grh); 36 extern int is_bpsw_dmr_prime(mpz_t n); 37 38 extern int _GMP_is_prime(mpz_t n); 39 extern int _GMP_is_prob_prime(mpz_t n); 40 extern int _GMP_is_provable_prime(mpz_t n, char ** prooftext); 41 42 #endif 43