I think my problem should be able to be solved with combination of multisets, but for some reason I do not get the right solution.
Example:
- My Number List:(1,1,1,1,1,2) = (5*1, 1*2)
- Example of a number of 3 combinations
- Solution = 2 = (1,1,1) (1,1,2) as it is combination the order does not matter
If I am right (which I am sure I am not) I should use: $n=2$ $k=3$
$\binom{n+k-1}{k} = \binom{4}{3} = \frac{4!}{3!1!} = 4$ which is wrong.
I saw a few different solutions for the same problem which does not seems right for me, and there are some definitely wrong solutions. Is there a generic formula?
Edit 1:
After JMoravitz suggestion I spent a bit of time looking into the inclusion exclusion theorem. So these are my assumptions now:
Say I build a table for numbers I can use for simplification:
\begin{array}{|c|c|c|c| C | } \hline 1& 2 & 3 & 4 & list\\ \hline 5 &1 & & &1,1,1,1,1,2\\ \hline 4 &2 & & &1,1,1,1,2,2\\ \hline 4 &1 &1 & &1,1,1,1,2,3\\ \hline 2 &2 &2 & &1,1,2,2,3,3\\ \hline \end{array}
In all the cases $k = 3$ I assume at the first and second problem I should use the same calculation: $|A ∪ B| = |A| + |B| - |A ∩ B| $
The third and forth I assume should be this: $|A ∪ B ∪ C| = |A| + |B| + |C| - |A ∩ B| - |A ∩ C| - |B ∩ C| + |A ∩ B ∩ C|$
So in my head the first addition is always all the possibilities which should be calculated from the model above. I am wondering what would be $k$ and $n$ in the rest of the calculation like $ |A ∩ B ∩ C|$.