How to eliminate arrangements with characters that are arranged in a row?

71 Views Asked by At

I have a math assignment where I have to create new password conditions for the accounts of an organisation.

The new minimum password conditions I chose, were a minimum of $12$ characters with replacement:

  • $3$ Capital Letters
  • $5$ Lower case letters
  • $3$ numbers
  • $1$ out of $5$ symbols (-_/;:)

I want to find the number of arrangements possible with these conditions but the restriction is that the $3$ of the same letters or numbers cannot be used in a row.

To calculate the number of arrangements with the minimum password conditions above, I multiplied $26^3 \cdot 26^5 \cdot 10^3 \cdot 5P1$ which equaled to $1,044,135,322,880,000$ arrangements.

I don't know how to calculate the number of arrangements possible with the restriction.

How would you guys go about doing this?

1

There are 1 best solutions below

0
On BEST ANSWER

Consider having the following events:

L - at least 3 lowercase letters next to each other

U - at least 3 uppercase letters next to each other

D - at least 3 digits next to each other

You're looking for $|L + U + D|$ which using Inclusion-Exclusion results in: $$|L + U + D| = |L| + |U| + |D| - |L\cap U| - |L\cap D| - |U\cap D| + |L\cap U\cap N|$$

$$|L| = \binom{10}{1}\binom{26}{1}26^226^310^35$$

You have 10 possible locations where you can start a run of 3 identical lower characters, and you have 26 possibilities for what the lowercase letter can be. For the rest, simply fill the gaps with the remaining characters. Note that you don't care if you end up with more than 3 characters next to each other, you want to remove these ones as well at the end.

Same as above you have: $$|U| = \binom{10}{1}\binom{26}{1}26^510^35$$ $$|D| = \binom{10}{1}\binom{10}{1}26^326^55$$

Now for the pairwise events $|L \cap U|$, $|L\cap D|$, $|L\cap N|$ you have both lower and upper case runs of identical letters/digits. If you count all the possibilities that you can set your password you'll end up with 15 possible locations for the runs. This gives: $$|L \cap U| = 15\cdot2!\binom{26}{1}\binom{26}{1}26^210^35$$ $$|L \cap D| = 15\cdot2!\binom{26}{1}\binom{10}{1}26^55$$ $$|U \cap D| = 15\cdot2!\binom{26}{1}\binom{10}{1}26^326^25$$

Last |L\cap U\cap N| means that you have identical run of digits, lowercase letters and uppercase letters all together. There are only 2 ways you can create such a combination but the combination of lowercase, uppercase and digits is 3! (note that you can have LUD, DUL, DLU, UDL, LDU, ULD). At the end, you only need to fill in the remaining gaps with the possible characters (in this case you can put 2 more lowercase letters and the symbol).

$$|L\cap U\cap N| = 2\cdot\binom{26}{1}\binom{10}{1}\binom{26}{1}26^25$$

The only thing left is to subtract this from the total possible arrangements that you calculated above.