# 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 ${n}_{1},...,{n}_{r}$ such that ${n}_{1}+\cdots +{n}_{r}=n$, this functions returns the number of permutations for $n$ elements taken from $r$ different elements and such that the $i$-th element repeats ${n}_{i}$ times.

## Syntax

```permutations_with_repetition(Integer, Integer, ..., Integer)
```
```permutations_with_repetition(Integer, List | Vector)
```

## Description

Given an integer $n$ and a set of integers ${n}_{1},...,{n}_{r}$ satisfying the conditions above, computes the number of permutations for $n$ elements taken from $r$ different elements and such that the $i$-th element repeats ${n}_{i}$ times.

Given an integer $n$ and a list or vector of $n$ elements, comprised of $r$ different elements and such that the $i$-th element repeats ${n}_{i}$ times, returns a list of all the different distinct permutations (in lexicographical order).