mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-03 Thread Niels Möller
Hi, Nikos Mavrogiannopoulos recently tried building Nettle, using mini-gmp for all bignum operations. As far as I understand, dnssec support has (recently?) been added to dnsmasq, using Nettle and GMP. I think GMP is used here only for *verifying* signatures; no private keys involved and no

mpz_probab_prime_p and negative inputs

2014-03-03 Thread Niels Möller
It seems mpz_probably_prime_p considers negated primes to also be prime. E.g, for n == -29 it returns 2, meaning definitely prime. Mathematically, I think -29 is usually considered neither prime, nor composite (its prime factorization is -1 * 29 and the unit factor -1 kind-of doesn't count, since

Re: mpz_probab_prime_p and negative inputs

2014-03-03 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: It seems mpz_probably_prime_p considers negated primes to also be prime. E.g, for n == -29 it returns 2, meaning definitely prime. Mathematically, I think -29 is usually considered neither prime, nor composite (its prime factorization is -1 * 29

Re: mpz_probab_prime_p and negative inputs

2014-03-03 Thread bodrato
Ciao, Il Lun, 3 Marzo 2014 11:08 pm, Torbjorn Granlund ha scritto: ni...@lysator.liu.se (Niels Möller) writes: It seems mpz_probably_prime_p considers negated primes to also be prime. I agree they are. On rings I usually take the following definition for primes: p is prime if and only if p