In: Advanced Math
Every teacher at a high school is given a n-digit code, e.g. 530...297 (n digits in total).
(1) How many different codes are there?
(2) How many codes read the same backward and forward? (Consider the cases where n is odd or even.)
(3) How many codes contain odd digits only?
(4) How many codes contain at least one even digit?
(5) Consider the case where n is 6. How many codes have distinct digits? (That is, no digit appears more than once.)
(1). In a n-digit code every digit is chosen from 0,1,2,3,4,5,6,7,8,9. So each digit can be chosen in 10 ways and hence, n digits can be chosen in ways. Therefore, there are different codes.
(2). First suppose n is even. Let n=2k. Then we can choose first k digits in any way but the last k digits will be reverse of first k digits. So, there are codes that read same forward and backward.
Now if n is odd, say, n=2k+1. Then we can choose first k+1 digits to be anything but the last k digits will be reverse of the first k digits. So for odd n, there are codes that read the same forward and backward.
(3). A code to contain only odd digits, we have choose from odd digits only. Now there are 5 odd digits, so each digit of a n-digit code can be chosen in 5 ways. Hence, there are codes that contains only odd digits.
(4). Observe that there codes in total among which codes contains odd digit only, so the rest codes contains atleast one even digit.
(5). Here, n is 6. We have to count the no of codes that contains distinct digits. So, the first digit can be chosen in 10 ways. Then the second digit can be chosen in 9 ways as we can't choose the same digit as in the first position. Then the 3rd digit can be chosen in 8 ways as we can't choose the same digits as in the 1st and 2nd position. Then the 4th,5th and 6th digit can be chosen in 7 ways, 6 ways and 5 ways respectively. So there are 6-digit codes containing distinct digits. Note that, this is actually .