nP(n, k) counts the permutations of k items taken from n (a number
of distinct items, or a multiset given as a vector, list, or named list of
counts), nC(n, k) the combinations, with replacement allowing repeats,
and nD(i) the derangements of the multiset i (or nD(n = 5) of n
distinct items, or nD(m = list(...)) of a multiset given by
multiplicities); all as SymPy's functions of the same names. With k
omitted, nP() and nC() sum over all sizes.
Usage
nP(n, k = NULL, replacement = FALSE)
nC(n, k = NULL, replacement = FALSE)
nD(i = NULL, n = NULL, m = NULL)