Counting $5$-character long Passwords with a Fixed Starting and Ending Points

496 Views Asked by At

Students are required to create $5$-character long passwords to access the library. The characters must be from lowercase letters or digits. Each password must start with a lowercase letter and end with a digit and contain at most $2$ digits. How many valid passwords are there?
Is this solution correct?
$(26×(26^3) ×10) + (26×(26^2×10)×10)$

2

There are 2 best solutions below

1
On BEST ANSWER

Your solution is not correct. As noted in the comments, you have not accounted for the fact that the extra digit can go in one of three different slots. Given the constraints, there are $26^4 \times 10$ passwords with exactly one digit, and there are $3 \times 26^3 \times 100$ passwords with exactly two digits, so the answer is the sum of those two numbers, $26^3 \times 560$.

1
On

26 possibilities for the first character
10 possibilities for the last character (a digit)

2 cases: there is a 2nd digit or there isn't.

case 1 : there is a 2nd digit
digit can go in any of 3 spots.
$T_1 = 3 \times 10 \times 26^2.$

case 2 : there is no 2nd digit
$T_2 = 26^3.$

Final answer:

$$26 \times 10 \times [T_1 + T_2].$$