Unique permutations from set with repetitions

292 Views Asked by At

I am new to combinatorics and might ask a trivial question:

There are $69$ different items, each present $4$ times. From this total of $276$ items, $20$ should be picked at random. I need the formula to find the total number of unique permutations possible. I struggle to deal with the condition that repetitions in the source have a maximum of $4$ and can be combined.

Any help or hint is appreciated.

EDIT:

To make it more down to earth: The $276$ items are lower and upper case characters, numbers and special characters, each present $4$ times. The $20$ equals the password length, formed from this character set. I would like to calculate the password strength against bruteforce attacks.

1

There are 1 best solutions below

7
On BEST ANSWER

I tried some elementary approaches and failed, but I was able to use exponential generating functions and some computer algebra to obtain a result.

You have 69 distinct characters that can appear up to 4 times on a sequence of length 20. For each character, we have the exponential generating function: $$ \left( \frac{x^0}{0!} + \frac{x^1}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!}\right) = \left( 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24}\right)$$

Thus, accounting all 69 characters, we have: $$EG(X) = \left( 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24}\right)^{69} $$ The number of passwords that you want is equivalent to the coefficient of $\frac{x^{20}}{20!}$ on the expansion of $EG(X)$. Using Mathematica, we get the expansion:

$$ EG(x) = \dots + 5980453108717018801550601671826075000 \frac{x^{20}}{20!} + \dots $$

Hence there are 5980453108717018801550601671826075000 different passwords.


PS.: The difficulty of this problems lies on the fact that you had posed some restrictions on both the maximum number of times that an character appears and the number of characters on the password. It may be an innocent looking problem, but questions like this can have messy solutions.