Is there a simple function that generates the series; $1,1,2,1,1,2,1,1,2...$ or $-1,-1,1,-1,-1,1...$ [closed]

I'm thinking about this question in the sense that we often have a term $(-1)^n$ for an integer $n$, so that we get a sequence $1,-1,1,-1...$ but I'm trying to find an expression that only gives every 3rd term as positive, thus it would read; $-1,-1,1,-1,-1,1,-1,-1...$

Alternatively a sequence yielding $1,1,2,1,1,2,1,1,2...$ could also work, as $n$ could just be substituted by it in $(-1)^n$


Let $F_n$ be the Fibonacci sequence $0,1,1,2,3,5,8,13,21,34,...$ then a possible sequence is $$(-1)^{F_{n+1}}$$


How about $$a_n=\frac 23\cos\left(\frac{2\pi n}3\right)+\frac 43\ $$


If you want something purely in terms of elementary operations, you could use the closed form:

$$\frac{2}{3}\left(-\frac{1}{2} + \omega^n + \omega^{2n}\right)$$

Where $\omega=\frac{-1+\sqrt{3}i}{2}$ is a complex cube root of unity. When $3|n$ we get $\omega^n =\omega^{2n} = 1$. On the other hand, when $n$ is not divisible by $3$, $\omega^n$ and $\omega^{2n}$ will be the two roots of the polynomial:

$$z^2 + z + 1$$

And from Vieta we get $\omega^n + \omega^{2n} = -1$.


$$-1+2\left \lfloor {\frac n 3} \right \rfloor -2\left\lfloor \frac {n-1}3 \right\rfloor $$ , where $n$ starts from $1$.