show/hide this revision's text 2 added 63 characters in body; added 92 characters in body

My math skills are a bit rusty, I've run into this problem which is I'm sure a classic variation of combinatorics (please name it if so).

Given a set of N items to choose from, choose R (nCr), but there are a fixed number of repetitions allowed and then no more. For instance, 6 items (a,b,c,d,e,f), choose 6, 2 repeats allowed:

valid answers:

a,a,b,b,c,d
a,a,a,b,b,c
a,b,a,b,a,c   [edit: repeats don't have to be contiguous]
a,a,a,c,b,b   [edit: repeats don't have to be adjacent to each other]

invalid:

a,a,b,b,c,c

not sure (zero or one repeat may be allowed, but I don't know yet):

a,b,c,d,e,f
a,a,a,a,a,a
a,a,a,a,b,c
show/hide this revision's text 1

enumerative combinatorics with fixed number repeats

My math skills are a bit rusty, I've run into this problem which is I'm sure a classic variation of combinatorics (please name it if so).

Given a set of N items to choose from, choose R (nCr), but there are a fixed number of repetitions allowed and then no more. For instance, 6 items (a,b,c,d,e,f), choose 6, 2 repeats allowed:

valid answers:

a,a,b,b,c,d
a,a,a,b,b,c

invalid:

a,a,b,b,c,c

not sure (zero or one repeat may be allowed, but I don't know yet):

a,b,c,d,e,f
a,a,a,a,a,a