8. Equation:

$$
\cos \frac{a \pi x}{x^{2}+4}-\cos \frac{\pi\left(x^{2}-4 a x+4\right)}{4 x^{2}+16}=-\sqrt{2-\sqrt{2}}
$$

inequality $f(a) \leqslant 5$. Answer: $a \in\left[-\frac{21}{2} ; \frac{21}{2}\right]$, the length of the interval is 21.

V-A. Let $a_{n}$ be the number of permutations $\left(k_{1}, k_{2}, \ldots, k_{n}\right)$ of the numbers $(1,2, \ldots, n)$ such that the following two conditions are satisfied:

- $k_{1}=1 ;$
- For any index $i=1,2, \ldots, n-1$, the inequality $\left|k_{i}-k_{i+1}\right| \leqslant 2$ holds.

What is the number $a_{N}$?
Solution. We will prove in several steps:

Step 1. Prove that there is a recurrence relation: $a_{n}=a_{n-1}+a_{n-3}+1$. The following are the possible beginnings of permutations:

- In the sequence $(1,2, \ldots, n)$. Discard the first one, and decrease the remaining numbers by 1. What remains satisfies the conditions for permutations at $n-1$. Therefore, there are $a_{n-1}$ such permutations.
- In the sequence $(1,3,2,4, \ldots, n)$. Discard the first three terms of the permutation $(1,3,2)$. Decrease the remaining numbers by three. What remains satisfies the conditions for permutations at $n-3$. Therefore, there are $a_{n-3}$ such permutations.
- There is also one permutation of the form $(1,3,5,7, \ldots, 6,4,2)$. In the middle, there is a transition from the last odd number not exceeding $n$ to the last even number not exceeding $n$. Thus, we have

$$
a_{n}=a_{n-1}+a_{n-3}+1
$$

Step 2. Calculate the initial elements of the sequence

$$
\begin{aligned}
& a_{1}=1, \quad a_{2}=1, \quad a_{3}=2, \quad a_{4}=4, \quad a_{5}=6, \quad a_{6}=9, \quad a_{7}=14, \quad a_{8}=21, \quad a_{9}=31, \\
& a_{10}=46, \quad a_{11}=68, \quad a_{12}=100, \quad a_{13}=147, \quad a_{14}=216, \quad a_{15}=317, \\
& a_{16}=465, \quad a_{17}=682, \quad a_{18}=1000, \quad a_{19}=1466, \quad a_{20}=2149, \quad a_{21}=3150, \\
& a_{22}=4617, \quad a_{23}=6767, \quad a_{24}=9918, \quad a_{25}=14536, \quad a_{26}=21304, \quad a_{27}=31223, \\
& a_{28}=45760, \quad a_{29}=67065, \quad a_{30}=98289, \quad a_{31}=144050, \quad a_{32}=211116, \quad a_{33}=309406, \\
& a_{34}=453457, \quad a_{35}=664574, \quad a_{36}=973981, \quad a_{37}=1427439, \quad a_{38}=2092014, \\
& a_{39}=3065996, \quad a_{40}=4493436, \quad a_{41}=6585451, \quad a_{42}=9651448, \quad a_{43}=14144885, \\
& a_{44}=20730337, \quad a_{45}=30381786, \quad a_{46}=44526672, \quad a_{47}=65257010
\end{aligned}
$$

Answer: $a_{41}=6585451$.