A word is a sequence of capital letters of our alphabet (that is, there are 26 possible letters). A word is called palindrome if has at least two letters and is spelled the same forward and backward. For example, the words "ARARA" e "NOON" are palindromes, but the words "ESMERALDA" and "A" are not palindromes. We say that a word $x$ contains a word $y$ if there are consecutive letters of $x$ that together form the word $y$. For example, the word "ARARA" contains the word "RARA" and also the word "ARARA", but doesn't contain the word "ARRA". Compute the number of words of 14-letter that contain some palindrome.
Problem
Source: 2024 Girls in Mathematics Tournament, Level A, Problem 1
Tags: combinatorics
26.10.2024 18:03
Let $f(n)$ be the number of words of n-letter such that doesn't contain any palindrome. So, $f(2)= 26\cdot 25$; $f(3)= 26\cdot 25\cdot 24$ and $f(4)= 26\cdot 25\cdot 24^2$ (if $abcd$ doesn't contain palindrome, so we have $f(3)$ possibilities to choose $abc$ and we only need $d\neq c$ and $d\neq b$ $\implies$ 24 possibilities for d) Lemma: $f(n)= 26\cdot 25\cdot 24^{n-2}$, $\forall n\in\mathbb{Z}, n\geq 2$ (I) Base case: $n=2$: $f(2)= 26\cdot 25= 26\cdot 25\cdot 24^{2-2}$ OK! $n=3$: $f(3)= 26\cdot 25\cdot 24= 26\cdot 25\cdot 24^{3-2}$ OK! (II) Hypothesis: Suppose that $f(k)= 26\cdot 25\cdot 24^{k-2}$ for some $k\geq 2$ (III) Induction Step: We will prove that is valid for $(k+1)$, i.e., $f(k+1)= 26\cdot 25\cdot 24^{k+1-2}= 26\cdot25\cdot 24^{k-1}$ Let $a_1a_2a_3\ldots a_{k-1}a_ka_{k+1}$ a word that doesn't contain a palindrome. So, $a_1a_2a_3\ldots a_{k-1}a_k$ is not a palindrome and doesn't contain a palindrome. Thus, we have $f(k)$ possibilities to choose $(a_1,a_2,\ldots, a_k)$ and we only need that: $a_{k-1}a_ka_{k+1}$ doesn't contain a palindrome $\implies a_{k+1}\neq a_{k-1}$ and $a_{k+1}\neq a_k$. So, we have $24$ possibilities for $a_{k+1}$. Therefore, $f(k+1)= 24\cdot f(k)= 26\cdot 25\cdot 24^{k-1}$, QED So, by the lemma, we have $f(14)= 26\cdot 25\cdot 24^{12}$ words that doesn't contain a palindrome. Therefore, the number of words 14-letter that contains a palindrome is $26^{14}-26\cdot 25\cdot 24^{12}$