Counting tuples with repetitions Fix a finite set 
$
S=\{1,\ldots,n\}. 
$ 
How many different ways are there to choose an ordered subset of $k$ elements (with repetitions) from it that has at least $r$ repetitions?
For example, if $n=3$, $k=2$ and $r=0$ then these are the ordered subsets $(1,2),(1,3),(2,3)$; with $n=3$, $k=3$, $r=1$, these are the ordered subsets $(1,1,1),(2,2,2),(3,3,3),(1,1,2),(1,1,3),(1,2,2),(1,3,3), (2,2,3),(2,3,3)$
 A: I’ll first count the subsets with exactly $r$ repetitions. Such a subset has $k-r$ distinct elements, which can be chosen in $\binom{n}{k-r}$ ways. Each of the $r$ repetitions can be of any of these $k-r$ elements, and two subsets with the same underlying set of distinct elements are equal if and only if the same numbers of repetitions are assigned to each element. Thus, the number of distinct ways of distributing the repetitions is the number of solutions in non-negative integers to the equation
$$x_1+\ldots+x_{k-r}=r\;,$$
which is 
$$\binom{(k-r)+r-1}r=\binom{k-1}r\;.$$
Thus, there are
$$\binom{n}{k-r}\binom{k-1}r$$
subsets with $r$ repetitions and
$$\sum_{\ell=0}^r\binom{n}{k-\ell}\binom{k-1}\ell$$
with at most $r$ repetitions. For $r=0$ this is just $\binom{n}k$, the number of subsets of $S$ of cardinality $k$, and for $r\ge k-1$ it’s $\binom{n+k-1}k$, the number of multisets of cardinality $k$ that can be chosen from $S$, but I don’t at the moment see any nice general closed form.
