GMP library (factorial, binomial, perfect power)
bodrato at mail.dm.unipi.it
bodrato at mail.dm.unipi.it
Mon Apr 30 17:26:54 CEST 2012
Ciao,
Il Lun, 23 Aprile 2012 7:13 pm, bodrato at mail.dm.unipi.it ha scritto:
> we should probably add also a general multi-factorial function
We have it now. It is a simple function, but it should be fast enough.
The new function is mpz_mfac_uiui(r, n, m).
mpz_mfac_uiui(r, n, 1), sets r = n!
mpz_mfac_uiui(r, n, 2), sets r = n!!
mpz_mfac_uiui(r, n, m), sets r = n!^(m) = n(n-m)(n-2m)...
I'm not sure about how to define the border cases, currently they are
defined as follows:
mpz_mfac_uiui(r, 0, m), sets r = 1
mpz_mfac_uiui(r, n, 0), sets r = n
The n=0 behavior is coherent with 0! = 0!! = 1, I'd let the m=0 case
undefined.
Suggestions?
Regards,
m
--
http://bodrato.it/software/combinatorics.html
More information about the gmp-devel
mailing list