What is the minimum number of passwords needed to guarantee that at least $2$ passwords have their lower case part the same?

110 Views Asked by At

I just read a question from here. But I think it's too simple, so I modify it to make it, if possible, more fun!

Assume computer passwords are between $6$ and $8$ characters long. Each character can be either an upper case letter, a lower case letter or a digit. Assume each password must have at least one upper case letter, at least one lower case letter and at most one digit.

Let $S$ be the set of passwords. What is the minimum cardinality of $S$ to guarantee that at least $2$ passwords have their lower case part the same?

The lower case part the same means they consist of the same characters.


Edit:

When I first posted my question someone in comment pointed out my error that I didn't be clear about what it meant "the lowercase part the same". But then I updated it immediately. It seems like it's my bad grammar that people still counted the "permutation-involved" answer. I'm sorry about that...

3

There are 3 best solutions below

0
On BEST ANSWER

Since a password consists of 6~8 characters, and at least 1 uppercase letter and 1 lowercase letter, now let's divide all possible password into cases:

Contain 1 lowercase: only one blank to fill:
$a$: $\binom{26}{1}$,

Contain 2 lowercase: two cases to consider:
$ab$: $\binom{26}{2}$,
$aa$: $\binom{26}{1}$.

Contain 3 lowercase:
$aaa$: $\binom{26}{1}$,
$aab$: $\binom{26}{2}\cdot2!$,
$abc$: $\binom{26}{3}$.

Contain 4 lowercase:
$aaaa$: $\binom{26}{1}$,
$aaab$: $\binom{26}{2}\cdot2!$,
$aabb$: $\binom{26}{2}$,
$aabc$: $\binom{26}{3}\cdot\binom{3}{1}$,
$abcd$: $\binom{26}{4}$.

Contain 5 lowercase:
$(5)$: $\binom{26}{1}$,
$(4,1)$: $\binom{26}{2}\cdot2!$,
$(3,2)$: $\binom{26}{2}\cdot2!$,
$(3,1,1)$: $\binom{26}{3}\cdot\binom{3}{1}$,
$(2,2,1)$: $\binom{26}{3}\cdot\binom{3}{1}$,
$(2,1,1,1)$: $\binom{26}{4}\cdot\binom{4}{1}$,
$(1,1,1,1,1)$: $\binom{26}{5}$.

Contain 6 lowercase:
$(6)$: $\binom{26}{1}$,
$(5,1)$: $\binom{26}{2}\cdot2!$,
$(4,2)$: $\binom{26}{2}\cdot2!$,
$(3,3)$: $\binom{26}{2}$,
$(4,1,1)$: $\binom{26}{3}\cdot\binom{3}{1}$,
$(3,2,1)$: $\binom{26}{3}\cdot3!$,
$^*(2,2,1,1)$: $\binom{26}{4}\cdot\binom{4}{2}\binom{2}{2}$,
$(2,1,1,1,1)$; $\binom{26}{5}\cdot\binom{5}{1}$,
$(1,1,1,1,1,1)$: $\binom{26}{6}$.

Contain 7 lowercase:
$(7)$: $\binom{26}{1}$,
$(6,1)$: $\binom{26}{2}\cdot2!$,
$(5,2)$: $\binom{26}{2}\cdot2!$,
$(4,3)$: $\binom{26}{2}\cdot2!$,
$(5,1,1)$: $\binom{26}{3}\cdot\binom{3}{1}$,
$(4,2,1)$: $\binom{26}{3}\cdot3!$,
$(3,2,2)$: $\binom{26}{3}\cdot\binom{3}{1}$,
$(4,1,1,1)$: $\binom{26}{4}\cdot\binom{4}{1}$,
$^*(3,2,1,1)$: $\binom{26}{4}\cdot\binom{4}{1}\binom{3}{1}\binom{2}{2}$,
$(2,2,2,1)$: $\binom{26}{4}\cdot\binom{4}{1}$,
$(3,1,1,1,1)$: $\binom{26}{5}\cdot\binom{5}{1}$,
$^*(2,2,1,1,1)$: $\binom{26}{5}\cdot\binom{5}{2}\binom{3}{3}$,
$(2,1,1,1,1,1)$: $\binom{26}{6}\cdot\binom{6}{1}$,
$(1,1,1,1,1,1,1)$: $\binom{26}{7}$.

$\dagger$ the $^*$-prefixed ones are which may be tricky but fun.

The answer should be the $(\textrm{sum}+1)$ if I didn't make mistake for each one.

0
On

Assuming that by "lowercase letter" you mean "one of the 26 lowercase letters of the English alphabet", then it's 8353082583.

Justification:

By the specification of the problem, there can be between 1 and 7 lowercase letters, and there are no other restrictions on the lowercase letters. So the number of 1-letter lowercase parts is $26$, the number of 2-letter lowercase parts is $26^2$, etc., so the number of distinct lowercase parts is

$$ 26^7 + 26^6 + 26^5 + 26^4 + 26^3 + 26^2 + 26 $$

The question then asks for 1 more than that (so as to guarantee a collision by the pigeonhole principle). So:

$$ 26^7 + 26^6 + 26^5 + 26^4 + 26^3 + 26^2 + 26 + 1 $$

Which is just $(26^8 - 1) / 25$, or $8353082583$

0
On

Let us put $8$(_)s. So if we have a (digit\uppercase letter\no character) we leave its position blank and we will keep the lowercase letters as they are.Also for a password having at most 8 characters, we have $1$ to $7$ lowercase letters

$\therefore$ There are $27$ possibilities for each blank -

$26$ - Lowercase case letters

$1$ - It is empty

$\therefore$ Number of passwords with distinct arrangements of lowercase letters for $8$ characters = $27^8 -(26^8 + 1)$

($-26^8$) to remove the possibility that all blanks are filled and ($1$) to remove the possibility that all are empty

$\therefore$ Minimum value of $S$ = $ 27^8 -(26^7+ 1) + 1 =27^8 - 26^7$