Re: mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-12 Thread Niels Möller
bodr...@mail.dm.unipi.it writes: I changed the check_small function in the mini-gmp/tests/t-pprime_p.c file you just pushed to: for (i = 0; i 25005200; i++) { mpz_set_si (n, i); check_one (n, isprime (i)); } It passed. How long did that take? This means that

Re: mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-12 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: if (reps 25 mpz_cmpabs_ui (n, 5000*5000+5000 + 41) 0) reps = 25; else if (reps 5000) reps = 5000; I didn't follow this thread too closely, but that code seems to suggest that an argument of 5000 makes sense. Even the most

Re: mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-12 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: I didn't follow this thread too closely, but that code seems to suggest that an argument of 5000 makes sense. I don't think it makes much sense. But I'd like to make sure that mpz_probab_prime_p returns 1 also in the case case a user passes a prime of

Re: mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-07 Thread bodrato
Ciao, Il Gio, 6 Marzo 2014 7:07 pm, Niels ha scritto: I agree with your analysis: with the suggested change the same answer is given. Earlier, at no extra cost, I say. I think there's some value in using precisely the same tests as in standard text books, and that it's a very unlikely case

Re: mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-07 Thread bodrato
Ciao, Il Mer, 5 Marzo 2014 6:07 pm, Niels ha scritto: Maybe it's good enough to stop the base loop when we get a = n-1, even if the caller specifies a large reps. I changed the check_small function in the mini-gmp/tests/t-pprime_p.c file you just pushed to: for (i = 0; i 25005200; i++)

Re: mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-06 Thread Niels Möller
bodr...@mail.dm.unipi.it writes: I agree with your analysis: with the suggested change the same answer is given. Earlier, at no extra cost, I say. The same comment applies to the current implementation in the main library. I think there's some value in using precisely the same tests as in

mini-gmp: mpz_congruent_p and mpz_probab_prime_p

2014-03-03 Thread Niels Möller
were missing in mini-gmp: mpz_congruent_p and mpz_probab_prime_p. I think it would make sense to add mpz_congruent_p to mini-gmp, and I think a subtraction followed by mpz_divisible_p is a good way to do it. I'm not sure what to do about mpz_probab_prime_p. One could implement it fairly simply