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++) { mpz_set_si (n, i); check_one (n, isprime (i)); } It passed. This means that all composites smaller than 5000*5000+5000+41 are detected within the first 25 reps. Any number outside the interval I tested will not trigger the if (mpz_cmp (y, nm1) >= 0) branch if the reps argument is >5000... Now, we can add in the "few exceptions" section of mini-gmp/README the sentence: mpz_probab_prime_p does work up to 5000 repetitions only. :-D Regards, m -- http://bodrato.it/ _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel