4
$\begingroup$

A password is constructed from the numbers 1-9 and the uppercase letters A,B,C,D,E,F,G,H. How many passwords can be constructed which consist of four numbers and 3 letters, if

(a) repetition is allowed?

(b) repetition is not allowed?

(c) no two digits can be next to each other, and no repetition allowed?

Attempt

(a) Number of placements of the three letters $={ 7 \choose 3} = 35$, number of combinations of the letters $=8^3 = 512$, number of combinations of the numbers $=9^4 = 6561$, total combinations = $35\times 512 \times 6561 = 117573120$

(b) Number of placements of the three letters $={ 7 \choose 3} = 35$, number of combinations of the letters $={}^8\mathrm P_6 = 336$, number of combinations of the numbers $=9\times 8\times7\times 6 = 3024$, total combinations = $35\times 336 \times 3024 = 35562240$

Are my approaches for parts (a) and (b) correct? I am not sure how to approach part (c) - any suggestions would be greatly appreciated.

$\endgroup$

2 Answers 2

1
$\begingroup$

Yes, your approach is correct. For c), note that the only way to have four digits with no two adjacent is if the password looks like #@#@#@#, where # represents a digit and @ a letter.

If you instead had three digits, there would be more possibilities. The number of valid arrangements of 3 #s and 4 @s is the same as the number of arrangements of 3 #s and 2 @s with no restrictions. To get from a short sequence like ##@#@ to the corresponding long sequence add an @ between the first and second #, and another between the second and third, to get #@#@@#@. (This will ensure that there can't be two adjacent #s in the long sequence.)

There are $\binom 52$ short sequences, so there are the same number of valid long sequences. Doing this trick, if you have $\ell$ letters and $d$ digits in a long sequence you get $\ell-d+1$ letters and $d$ digits in a short sequence, so the number of patterns is always $\binom{\ell+1}d$. (If $\ell+1<d$ then there aren't enough letters to have no two digits adjacent.)

[edit] Actually you can get the same result rather more simply - there are $\ell+1$ spaces between the letters (including the space at the beginning and the space at the end), and you need to choose $d$ different spaces to put the digits in.

$\endgroup$
4
  • $\begingroup$ Thanks for the suggestion! Is there a general way to pick that pattern though? For example, if the constraint was 3 digits and 4 letters, in that case there would be a lot more possible password set-ups $\endgroup$
    – Sjoseph
    May 1, 2018 at 11:03
  • $\begingroup$ Yes, I'll edit and explain. $\endgroup$ May 1, 2018 at 11:04
  • $\begingroup$ Great - thanks for giving that extra detail. $\endgroup$
    – Sjoseph
    May 1, 2018 at 11:18
  • $\begingroup$ @Sjoseph It just occurred to me I was making it unnecessarily complicated - see the edit. $\endgroup$ May 1, 2018 at 11:21
1
$\begingroup$

If repetition is allowed first place numbers in $7 \choose 4$ ways, then just place the letters in the left over places. Then you have $9^4 \cdot 8^3$ options for the letters.

For $(b)$ first place numbers in $7 \choose 4$ ways, then just place the letters in the left over places. Repetition is not allowed so we have $9 \cdot 8 \cdot 7 \cdot6$ options for the numbers, while for the letters we have $8 \cdot 7 \cdot 6$. Just multiply everything. So I guess you were correct about these two.

For $(c)$ since you have $7$ spaces to put the letters and numbers, fix the alternating spaces for numbers like $* x * x * x* $ where $*$ represent the numbers, and $x$ represent the letters. This is the only way for the numbers not to stick together. Repetition is not allowed so we have $9 \cdot 8 \cdot 7 \cdot6$ options for the numbers, while for the letters we have $8 \cdot 7 \cdot 6$. Altogether $9\cdot(8\cdot7\cdot6)^2$.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks for the explanation! $\endgroup$
    – Sjoseph
    May 1, 2018 at 11:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.