primorial(negative)

Marco Bodrato bodrato at mail.dm.unipi.it
Mon Nov 9 21:55:03 UTC 2015


Ciao,

Il Dom, 8 Novembre 2015 9:27 am, Marc Glisse ha scritto:
> add primorial. However, I am not sure what the expected behavior is for
> negative numbers. For factorial it was a clear error. For primorial, we
> could return 1, same as we do for primorial(0). Or we could throw as we do
> for factorial. Any opinion?

We have never been completely coherent with primes and negative numbers, I
fear:
mpz_probab_prime_p (-3) returns "prime", but
mpz_nextprime (-5) returns 2 ...

I do not see any particular mathematical meaning for primorial (-n). I'd
explicitly document that the function is defined only for non-negative
numbers...

Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-discuss mailing list