I have a need to generate all combinations of placing 8 standard playing cards of only 2 distinct ranks, (suits are ignored), into 16 possible positions. For example, suppose we had A A A A 2 2 2 2 and had 16 positions to put them into so that the first one might look like this:
_ _ _ _ _ _ _ _ A A A A 2 2 2 2 and the next one might look like this _ _ _ _ _ _ _ _ A A A 2 A 2 2 2. The very last combination might be 2 2 2 2 A A A A _ _ _ _ _ _ _ _.
How do I count these?
Choose four spaces of the sixteen for the first rank (how many ways?) then choose four spaces (out of how many) for the second rank (how many ways?)