Q: Count the number of passwords with following constraints. Assuming digits = {0, 1, …..9},

letters = {a, b, ….. y, z}
(a) 5 characters which are digits or letters.
(b) 4 characters which are digits or letters, with at least 1 digit.
(c) 4 characters which are digits. Adjacent characters are not the same.
(d) 6 characters which are letters. The first half must not equal to the last half.

To count the number of passwords with the given constraints, we need to break down each constraint and calculate the possibilities.

(a) 5 characters which are digits or letters.
In this case, we have 36 options for each character (26 letters + 10 digits). Since we need 5 characters, the total number of passwords would be 36^5.

(b) 4 characters which are digits or letters, with at least 1 digit.
To solve this, we can break down the problem into two parts - one with 4 characters (with no restriction) and the other with at least 1 digit.

For the first part, we have 36 options for each character. Therefore, the total number of possibilities for the first part is 36^4.

For the second part, we need to calculate the number of passwords that have at least one digit in the 4-character sequence. To do this, we can subtract the number of passwords without any digits from the total number of passwords in the first part.

The number of passwords without any digits in the 4-character sequence is equal to the number of passwords that have all letters in the sequence, which is 26^4.

So, the total number of passwords in this case is 36^4 - 26^4.

(c) 4 characters which are digits. Adjacent characters are not the same.
Since we have 10 digits (0-9) available and adjacent characters cannot be the same, the first digit can be chosen freely from the 10 options. For each subsequent digit, there are only 9 available options (excluding the digit chosen before).

Therefore, the total number of passwords in this case is 10 * 9 * 9 * 9.

(d) 6 characters which are letters. The first half must not equal the last half.
To calculate this, we can again break it down into two parts - one with the first half and the other with the last half.

For the first 3 letters (first half), we have 26 options for each character. Therefore, the total number of possibilities for the first half is 26^3.

For the last 3 letters (last half), we need to exclude the possibilities that are the same as the first half. Since each letter in the first half could have been any of the 26 letters, we have 26 possibilities that we need to remove from the total possibilities for the last half.

Therefore, the total number of passwords in this case is 26^3 - 26.

To summarize:
(a) Total number of passwords = 36^5
(b) Total number of passwords = 36^4 - 26^4
(c) Total number of passwords = 10 * 9 * 9 * 9
(d) Total number of passwords = 26^3 - 26