7 digit palindrome problem

545 Views Asked by At

This is my problem: From {1,2,3, ..., 9} How many palindromes of length 7 are there, where each digit can appear at most twice

2

There are 2 best solutions below

0
On BEST ANSWER

To choose a palindrome:

  • First, you have to decide which number goes in the middle ($4$-th position), so and you have 9 possibilities.

  • Notice that this number cannot appear anywhere else in the palindrome, otherwise it would appear at least three times. So, in the other positions, you can only pick from the 8 remaining numbers.

  • In order to completely specify your palindrome, you only need to choose its first three digits. Because you do not allow for any repetitions, all those digits have to be different, so you have $8 \times 7 \times 6$ choices.

This shows that there are exactly $9 \times 8 \times 7 \times 6 = \frac{9!}{5!} = 3024$ palindromes of length 7 with no more than 2 appearances of the same digit.

(However, I am not sure that this was the initial question, so ...)

0
On

The number should be such that $\overline{abcdcba}$, $\overline{aabcbaa}$, $\overline{abbcbba}$. For these cases, the number of palindromes are $(9*8*7*6*1*1*1)+(9*1*8*7*1*1*1)+(9*8*1*7*1*1*1)=4032$.

I'm only able to think of these cases till now. I'll update if I get more.

If you consider all the bases, then there are infinitely many 7 digit palindromes IMO. (I considered base 10 in this answer)