Pascal's theorem for non-unique sets?

The Pascal rule when counting a subset of a collection works fine when the collection contains unique entities.

Is there a modification to this rule when a collection contains duplicate elements?

For example, when I try to find the counter of combinations of letters A, B, C, D, itโ€™s easy to see that it is 1 + 4 + 6 + 4 + 1 (from Pascalโ€™s triangle) = 16, or 15 if I delete the entry โ€œuse none the letter ".

Now, what if the set of letters A, B, B, B, C, C, D? By calculating manually, I can determine that the sum of the subsets is: 1 + 4 + 8 + 11 + 11 + 8 + 4 + 1 = 48, but this does not correspond to the triangle we know.

Question: How do you modify the Pascal Triangle to take into account the repeating entities in the set?

+3
source share
6 answers

It looks like you want to know how many subsets have, say, 3 elements. The math for this is very complex, very fast. The idea is that you want to combine all the combinations of ways to get there. So you have C (3,4) = 4 ways to do this without duplicating items. B can be repeated twice in C (1,3) = 3 ways. B can be repeated 3 times in one way. And C can be repeated twice in C (1,3) = 3 ways. Only 11. (Your 10, which you received by hand, were wrong. Sorry.)

, . , , , . , (1 + x) ^ n. ( , .) , , (1 + x + x ^ 2). 3 (1 + x + x ^ 2 + x ^ 3). , :

(1 + x) (1 + x + x^2 + x^3) (1 + x + x^2) (1 + x)
  = (1 + 2x + 2x^2 + 2x^3 + x^4)(1 + 2x + 2x^2 + x^3)
  = 1    + 2x   + 2x^2 +  x^3 +
    2x   + 4x^2 + 4x^3 + 2x^4 +
    2x^2 + 4x^3 + 4x^4 + 2x^5 +
    2x^3 + 4x^4 + 4x^5 + 2x^6 +
    x^4  + 2x^5 + 2x^6 +  x^7
  = 1 + 4x + 8x^2 + 11x^3 + 11x^4 + 8x^5 + 4x^6 + x^7

, , . ( .)

+4

. , .

+4

, , "". :

p1^a1.p2^a2....pn^an

p1 - . ai - 1, 2 ^ n. , : (a1 + 1) (a2 + 1)... (an + 1), .

, , , 48 47, .

+4

. C (k, n), - .

, A B1 B2 C1 D1 == A B2 B1 C1 D1, C (5,5) C (2,2).

+2

( , ) . , 2 ^ n . ( "-" ) , "". m_1, m_2... m_n , (1 + m_1) * (1 + m_2) *... (1 + m_n).

+1

, "" . . Lisp .

0

Source: https://habr.com/ru/post/1697222/


All Articles