In: Statistics and Probability
A word that reads the same from left to right and right to left is a palindrome. For example, "I", "noon" and "racecar" are palindromes. In the following, we consider palindromic integers. Note that the first digit of an integer cannot be 0.
How many positive palindromic integers are 5-digit long and contain 7 or 8?
Here there must be 5 digits and it shall contain 7 or 8 that means other two digitsshall be 7 or 8 only. Only one more number digit shall be varied.
so here total possibilities when 7 is the first digit that means last digit would be 7 also.
Here now for in between 3 numbers if the next digit is 8 then second last digit shall be 8 and there are 10 possibilities of middle digit so total possiblities = 10
now if 8 is the middle number than also there are 10 possibilites for digit place 2 and digit place 4.
Total possibilities when 7 is the first number = 10 + 10 = 20
Similarly there are total 20 possibilities when the first number is 8 = 20
Here if now the first digit is different than 7 or 8
then for first digit can have 9 values as 0 is not allowed. For middle 3 digits there is only two possibilities which is x787x and x878x.
so here total possibilities = 2 * 9 = 18
Total possibilities = 18 + 20 + 20 = 58