0

For example, if I have $k=3$ colors/types of balls (a, b, c) and I generate a sequence of length $n=4$ by picking them with replacement. I can get sequences like: $a a a a, a a a b, ... cccc$. However, I want to place an additional constraint that would only include sequences where each color appears $\leq m$ number of times. With $m = 2$, this would include the sequence $a a b c$, but exclude $c b b b$ ($b$ appears more than $m$ times).

I had a look at the question Number of ways to put $n$ unlabeled balls in $k$ bins with a max of $m$ balls in each bin, but if I understand correctly, that would only work if we considered sequences $a b a$, and $a a b$ as identical, $a$ and $b$ being box types ($k=2$) and ball count being 3 ($n=3$) in this case.

How do I approach this problem analytically and in a general case?

naktinis
  • 143

1 Answers1

1

You might set up a recursion in the number of colours. Specify the positions of all the blue balls, then solve the rest of the problem with $k-1$ colours.

$$F(n,m,k)=\sum_{i=0}^m{n\choose i}F(n-i,m, k-1)$$

Empy2
  • 50,853