Question 162
Let $n \in \mathbb{N}$ and let $A_{n}$ be the set of all permutations $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ of the set $\{1,2, \ldots, n\}$ such that
$$
k \mid 2\left(a_{1}+a_{2}+\cdots+a_{k}\right) \quad \text{ for every } 1 \leqslant k \leqslant n.
$$
Determine the number of elements of the set $A_{n}$.
$$
k \mid 2\left(a_{1}+a_{2}+\cdots+a_{k}\right) \quad \text{ for every } 1 \leqslant k \leqslant n.
$$
Determine the number of elements of the set $A_{n}$.