A simple mathematical expression for the periodic sequence $(1, -2, -1, 2, 1, -2, -1, 2,\dots)$

The sequence is just $S_n=1, -2, -1, 2$ repeated indefinitely. The best I can do is:

$$S_n= \frac{(i - 2)\,i^n}{2i} + \frac{(i+2)\,(-i)^n}{2i} $$

where $i$ is the imaginary unit. In fact, this expression is where the sequence comes from. Can it be simplified, like using $(-1)^n$ for an alternating sequence of $1$ and $-1$? These values appear as part of a larger formula. Currently, I am simply using a more computational expression: V(n) = the (n modulo 4)'th element of [+1,-2,-1,+2], but this is rather hacky.


Solution 1:

Expanding on my comment:

$$\cos(\pi n/2) -2\sin(\pi n/2)$$

Solution 2:

Per the OP's request, given the sequence, $$\alpha_n=1,-2,-1,2,1,-2,-1,1,\dots$$ and $\alpha_0=1$, we are to generate it using $(-1)^n$ and well-defined sequences of integers. The unsigned version is easy to do, $$\beta_n = \tfrac{3-(-1)^n}2=1,2,1,2,1,2,1,2,\dots$$ So the problem really is to generate the signs, $$U_n = 1,-1,-1,1,1,-1,-1,1,\dots$$ and fortunately answered by this post and this, $$U_n =(-1)^{n(n+1)/2} = \sqrt{2}\cos\tfrac{(2n+1)\pi}4$$

$\color{blue}{Update:}$ We also have the rather exotic, $$U_n = (-1)^{T_n}$$ with tribonacci numbers $T_n$, $$T_n=\sum_{k=0}^{n-1}\sum_{j=0}^{n-k-1}\tbinom{n-k-1}{j}\tbinom{j}{k-j}=\color{blue}0,1, 1, \color{blue}{2, 4}, 7, 13, \color{blue}{24, 44}, 81, 149, \color{blue}{274, 504},\dots$$ and $T_0=0$.

Alternatively, we seek, $$V_n = \tfrac{2n+1-(-1)^n}4= 0,1,1,2,2,3,3,4,\dots$$ which this post has considered. It then gives us three ways to form $\alpha_n$ as,

$$\alpha_n = \beta_n \,U_n=\tfrac{3-(-1)^n}2\,(-1)^{n(n+1)/2}\,=\,\tfrac{3-(-1)^n}2\,(-1)^{T_n}\tag1$$

and

$$\alpha_n = \beta_n \,(-1)^{V_n} = \tfrac{3-(-1)^n}2\,(-1)^{\frac14\big(2n+1-(-1)^n\big)}\tag2$$

P.S. For a signed sequence with period $5$, see here.