Necessary Conditions for Existence of Skolem Sequence

Theorem
A Skolem sequence of order $n$ can only exist if $n \equiv 0, 1 \pmod 4$.

Proof
Let $S$ be a Skolem sequence of order $n$.

Let $a_i$ and $b_i$ be the positions of the first and second occurrences respectively of the integer $i$ in $S$, where $1 \le i \le n$.

We can thus conclude that:
 * $b_i - a_i = i$

for each $i$ from 1 to $n$.

Summing both sides of this equation we obtain:
 * $\displaystyle \sum_i^n b_i - \sum_i^n a_i = \sum_i^n i = \frac {n \left({n + 1}\right)} 2$

Now the $a_i$ and the $b_i$ represent the positions in the sequence from $1$ to $2n$.

Hence:
 * $\displaystyle \sum_i^n b_i + \sum_i^n a_i = \frac {2 n \left({2 n + 1}\right)} 2 = n \left({2 n + 1}\right)$

Summing the previous two equations we obtain the identity:
 * $\displaystyle \sum_i^n b_i = \frac {n \left({5 n + 3}\right)} 4$

The left hand side of this last equality is a sum of positions and thus must be an integer.

We conclude that the right hand side must also be an integer.

This occurs exactly when: $n \equiv 0, 1 \pmod 4$