If we have a multiset S = {a,a,b,b,b,c,d}
How to calculate all possible combinations if we take r items at a time?
For example if r = 3 then the combinations will be:
a,a,b
a,a,c
a,a,d
b,b,b
b,b,a
b,b,c
b,b,d
a,b,c
a,b,d
a,c,d
b,c,d
The only thing I know is that the last four of the combinations are taken from the combinations of distinct elements {a,b,c,d}
taken 3 at a time.
Also the combination that takes the form A,A,A
such as b,b,b
will appear for every element that repeats at least r times.
I find it complicated if we have a bigger multiset and some items repeat more than r times and some less than r times.
I only know some formulas like nCr and nPr but they don't work.