scipy.special.factorialk#

scipy.special.factorialk(n, k, exact=True)[source]#

Multifactorial of n of order k, n(!!…!).

This is the multifactorial of n skipping k values. For example,

factorialk(17, 4) = 17!!!! = 17 * 13 * 9 * 5 * 1

In particular, for any integer n, we have

factorialk(n, 1) = factorial(n)

factorialk(n, 2) = factorial2(n)

Parameters
nint

Calculate multifactorial. If n < 1 - k, the return value is 0. Otherwise if n <= 0, the return value is 1.

kint

Order of multifactorial.

exactbool, optional

If exact is set to True, calculate the answer exactly using integer arithmetic.

Returns
valint

Multifactorial of n.

Raises
NotImplementedError

Raises when exact is False

Examples

>>> from scipy.special import factorialk
>>> factorialk(5, 1, exact=True)
120
>>> factorialk(5, 3, exact=True)
10