M HYPE SPLASH
// updates

Password consists of 5 characters

By Sarah Scott
$\begingroup$

Password consists of 5 characters, these characters can be a digit (0-9) and the letters ABC 26 letters. Each character can be repeated more than once. How many different passwords that have at least one digit and at least one letter?

I tried to think of it this way:$$10 * 26 * 36 ^ 3=12,130,560$$

Because there is at least one letter and one digit and hence have 36 other options ...

According to the book: $$36^5-[10^5+26^5]=48,484,800$$

$\endgroup$ 6

2 Answers

$\begingroup$

The total number of sequences of 5 characters is $36^5$. Consider the sequences of 5 characters that are not valid passwords. There are two types of them: the sequences containing only digits ($10^5$ possible sequences) and the sequences containing only letters ($26^5$ possible sequences). This explains the (right) answer of the book.

Coming back to your answer, the problem is that you are counting this way the number of sequences having a digit in the first position and a letter in the second position.

Edit. If you want to use your method, you should decompose the cases as follows. Let $D$ denote a digit, $L$ a letter and $S$ any symbol. Then you may have the following mutually disjoint cases $$ LDSSS, LLDSS, LLLDS, LLLLD, DLSSS, DDLSS, DDDLS, DDDDL $$ leading to the number $$ 26 \times 10 \times 36^3 + 26^2 \times 10 \times 36^2 + 26^3 \times 10 \times 36 + 26^4 \times 10 + 10 \times 26 \times 36^3 + 10^2 \times26 \times 36^2 + 10^3 \times 26 \times 36 + 10^4 \times 26 = 48484800 $$ If you know automata theory, it is similar to finding the complement of a regular expression.

$\endgroup$ 3 $\begingroup$

Either you calculate the possible ways by counting ($1N-4L$), ($2N-3L$), ($3N-2L$), ($4N-3L$) and you sum them. or you calculate the case where all situation could happen and subtract the the two cases where all are digits(no litter) and all litter(no digit) from the total case.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy