[Combinatorics]
Problem: A Skolem sequence of order $n$ is a sequence $\left(s_{1}, s_{2}, \ldots, s_{2 n}\right)$ of $2 n$ integers satisfying the conditions:

i) for every $k$ in $\{1,2,3, \ldots, n\}$, there exist exactly two elements $s_{i}$ and $s_{j}$ with $s_{i}=s_{j}=k$, and

ii) if $s_{i}=s_{j}=k$ with $i<j$, then $j-i=k$.


For example, $(4,2,3,2,4,3,1,1)$ is a Skolem sequence of order 4.
List all Skolem sequences of order 4.

Solution: We start by placing the two 4's. We systematically try each pair of possible positions from positions 1 and 5 to positions 4 and 8 . For each of these positions, we try placing


the two 3's in each pair of possible positions, and then see if the two 2's and two 1's will fit.

(We can reduce our work by noticing that if a Skolem sequence has the two 4's in positions 1 and 5 , then reversing the sequence will give a Skolem sequence with the two 4 's in positions 4 and 8 . So we only need to consider putting the two 4's in positions 1 and 5 , and in positions 2 and 6 . The remaining possibilities can be dealt with by reversing.)

Thus, the six possible Skolem sequences of order 4 are:

$(4,2,3,2,4,3,1,1)$ and its reverse, $(1,1,3,4,2,3,2,4)$

$(4,1,1,3,4,2,3,2)$ and its reverse, $(2,3,2,4,3,1,1,4)$

$(3,4,2,3,2,4,1,1)$ and its reverse, $(1,1,4,2,3,2,4,3)$

Final answer: (4,2,3,2,4,3,1,1),(1,1,3,4,2,3,2,4),(4,1,1,3,4,2,3,2),(2,3,2,4,3,1,1,4),(3,4,2,3,2,4,1,1),(1,1,4,2,3,2,4,3)