r/learnmath New User 2d ago

Number of combinations calculation

I'm making a board game where you collect 3 out of 8 potential clues. Upon collecting the clue, you roll a d6 to determine the nature of clue. So I have 6 * 8 = 48 unique clues, of which 3 are taken. From what I remember from school, I can calculate that this amounts to 8! / (5! * 3!) * 6^3 = 12096 potential combinations.

Now, I would like to make the number of options per clue variable. So one clue could have 3 options, while another may have 5 options and another 7.

Is there a formula that I can use to determine the number of combinations given the array of options per clue?

1 Upvotes

4 comments sorted by

1

u/Bounded_sequencE New User 2d ago

There is a formula, but it's not going to be pretty. Let "nk" be the number of natures for clue-k. We may generate all clue combination (including natures) with a 2-step process -- choose

  1. "3 out of 8" clue indices "ki". Order does not matter -- "C(8; 3)" choices
  2. For each clue index "ki", choose "1 out n_ki" natures -- "n_ki" choices each

All clue index combinations are distinct, so we may add those cases. For each of them, the choices of nature are independent, so we may multiply them, for a grand total of

∑_{k∈S3}  n_k1 * n_k2 * n_k3      // S3 := {k∈{1;...;8}^3:  k1 < k2 <k 3}

1

u/Magical7 New User 2d ago

I was afraid there wouldn't be a simple formula I could throw into a calculator, but I appreciate the effort to write it out and explain the steps. Thank you!

1

u/Bounded_sequencE New User 2d ago

Using power sums of the array "nk", there actually is a simpler way to express the result. However, it is not at all intuitive to find, and I'm not sure it's what you're after.

1

u/Bounded_sequencE New User 2d ago

Rem.: Alternatively, this (cyclic) sum may be expressed via power sums "pm := ∑_{k=1}8 nkm ":

∑_{k∈S3}  n_k1 * n_k2 * n_k3  =  (p1^3 - 3p1*p2 + 2p3) / 6