This is documentation for an old release of SciPy (version 1.8.1). Read this page in the documentation of the latest stable release (version 1.15.1).

scipy.special.perm#

scipy.special.perm(N, k, exact=False)[source]#

Permutations of N things taken k at a time, i.e., k-permutations of N.

It’s also known as “partial permutations”.

Parameters
Nint, ndarray

Number of things.

kint, ndarray

Number of elements taken.

exactbool, optional

If exact is False, then floating point precision is used, otherwise exact long integer is computed.

Returns
valint, ndarray

The number of k-permutations of N.

Notes

  • Array arguments accepted only for exact=False case.

  • If k > N, N < 0, or k < 0, then a 0 is returned.

Examples

>>> from scipy.special import perm
>>> k = np.array([3, 4])
>>> n = np.array([10, 10])
>>> perm(n, k)
array([  720.,  5040.])
>>> perm(10, 3, exact=True)
720