Although the previous answer is clever, given this problem I would attack it by considering things mod $3$ and mod $8$. In either mod, the sequence will still be in arithmetic progression (except that it is permitted to cross the $n-1 \rightarrow 0$ step; for example, in mod $8$, the sequence $3,6,1$ is in arithmetic progression).
In mod $3$, the only quadratic residues (numbers mod $3$ that are squares of other numbers mod $3$) are $0$ and $1$. So the sequence has to be $0,0,0$ or $1,1,1$; sequences like $0,1,2$ and $0,2,1$ contain the forbidden $2$. In either of those cases, $k \equiv 0 \pmod 3$.
In mod $8$, the only quadratic residues are $0, 1, 4$. So the sequence $a,b,c$ has to be one of: $(0,0,0), (1,1,1), (4,4,4), (0,4,0), (4,0,4)$.
The first three of those have $k \equiv 0 \pmod 8$. THe other two have $k \equiv 4 \pmod 8$ and need to be eliminated for our result to be proven.
The fourth sequence turns out not to work: It would mean $a$ and $c$ are both divisible by $4$ and $b$ is of the form $4n+2$ in order for $b^2\equiv 2 \pmod 8$. Then if $a=4m$ and $c=4p$,
$$
(4m)^2 = (fn+2)^2 - 4 = 16n^2+16mn \\
b^2 = (4n+2)^2 + 4 = (16n^2 + 16mn+4) + 4 = (4p)^2 \\
16n^2 + 16mn+8 = 16p^2 \\
2(m^2+n^2) + 1 = 2p^2
$$
But the LHS is odd and the RHS is even, so the residue sequence $(0,4,0)$ does not work.
A similar argument shows $(4,0,4)$ also fails in the same way. Thus one of the $k\equiv 0$ sequences must hold, therefore $k$ is divisible by $8$.
From which $k$ is divisible by $3\times 8 = 24$.