Ciao,
Il 2020-10-03 03:58 Seth Troisi ha scritto:
I modified the patch a tiny bit. Still hoping to get this in for an
I think that the patch is interesting: a function for searching primes
backward in the sequence of integers is missing and seems useful.
The proposed interface is the following.
@deftypefun int mpz_prevprime (mpz_t @var{rop}, const mpz_t @var{op})
@cindex Previous prime function
Set @var{rop} to the greatest prime less than @var{op}.
If a previous prime doesn't exist (i.e. @var{op} < 3), rop is unchanged
and
0 is returned.
Return 1 if @var{rop} is a probably prime, and 2 if @var{rop} is
definitely
prime.
I personally do not like the idea that a previous prime can "not exist",
because in my opinion -2 is a prime, and there are as many negative
primes as there are positive ones... The function mpz_probab_prime_p in
our library agrees with my opinion... but... ok, that's my opinion only.
Anyway, the return value is used also to return something more
interesting: 1 or 2, with the same meaning that the return value has for
the function mpz_probab_prime_p.
Should we add a return value also to the function mpz_nextprime?
Ĝis,
m
_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel