Problem 8.7. How many ways are there to arrange in a row $n$ crosses and 13 zeros so that among any three consecutive symbols there is at least one zero, if

(a) (2 points) $n=27$

(b) (2 points) $n=26$ ?
Answer: (a) 14. (b) 105.

Solution. Let's number the zeros from left to right with numbers from 1 to 13. Denote the number of crosses before the first zero by $a_{1}$, between the first and second zero by $a_{2}, \ldots$, after the thirteenth zero by $a_{14}$. We get that $a_{1}+a_{2}+\ldots+a_{14}=n$. The condition that among any three consecutive symbols there is at least one zero is equivalent to the fact that three crosses cannot go in a row, that is, $a_{i} \leqslant 2$ for any $i=1,2, \ldots, 14$. Note that suitable sequences of crosses and zeros are in one-to-one correspondence with sequences $a_{1}, a_{2}, \ldots, a_{14}$ with the specified conditions.

(a) The sum of 14 non-negative integers is 27, and each of them is no more than 2. This means that one of the $a_{i}$ must be equal to 1, and all the others must be equal to 2. Since $i$ can take any value from 1 to 14, we get that there are exactly 14 options.

(b) Now the sum of 14 non-negative integers is 26. This means that either some $a_{i}$ is equal to 0, and all the others are equal to 2, or some $a_{j}$ and $a_{k}$ are equal to 1, and all the others are equal to 2. In the first case, we get 14 options. In the second case, we get $\mathrm{C}_{14}^{2}=\frac{14 \cdot 13}{2}=$ 91 options, since we need to choose 2 indices out of 14 possible ones.

In total, we get exactly $14+91=105$ options.