numbperm - Maple Help

combinat

 numbperm
 Count the number of permutations

 Calling Sequence numbperm(n) numbperm(n, r)

Parameters

 n - a list/set of objects or an integer r - (optional) integer

Description

 • If n is a list or set, then numbperm counts the permutations of the elements of n taken r at a time. If n is a non-negative integer, it is interpreted in the same way as a list of the first n integers. If r is not specified, it is taken to be $r=\mathrm{numelems}\left(n\right)$.
 • The count of permutations takes into account duplicates in n. In the case where there are no duplicates, the count is given by the formula  $\frac{n!}{\left(n-r\right)!}$. Otherwise the generating function is used.
 • The function permute will compute the number of permutations.  Thus numbperm(n, r) = numelems(permute(n, r)).
 • The command with(combinat,numbperm) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{combinat},\mathrm{numbperm}\right)$
 $\left[{\mathrm{numbperm}}\right]$ (1)
 > $\mathrm{numbperm}\left(3\right)$
 ${6}$ (2)
 > $\mathrm{numbperm}\left(3,2\right)$
 ${6}$ (3)
 > $\mathrm{numbperm}\left(\left[a,b\right]\right)$
 ${2}$ (4)
 > $\mathrm{numbperm}\left(\left\{a,b,c\right\},2\right)$
 ${6}$ (5)
 > $\mathrm{numbperm}\left(\left[a,a,b\right],2\right)$
 ${3}$ (6)