Permutations with repetition

Computes the number of permutations with repetitions. That is, given a non-negative integer n and a sequence of one or more additional non-negative integers n1,...,nr such that n1++nr=n, this functions returns the number of permutations for nLaTeXn elements taken from r different elements and such that the i-th element repeats ni times.

Syntax

permutations_with_repetition(Integer, Integer, ..., Integer)
 Vector)

Description

Given an integer nLaTeXn and a set of integers n1,...,nrLaTeXn_1, ..., n_r satisfying the conditions above, computes the number of permutations for nLaTeXn elements taken from rLaTeXr different elements and such that the iLaTeXi-th element repeats niLaTeXn_i times.

combinatorics.permutations_with_repetition1.calc.png

Given an integer nLaTeXn and a list or vector of nLaTeXn elements, comprised of rLaTeXr different elements and such that the iLaTeXi-th element repeats niLaTeXn_i times, returns a list of all the different distinct permutations (in lexicographical order).

combinatorics.permutations_with_repetition2.calc.png