Write the general term of the periodic sequence $1$, $-1$, $-1$, $1$, $-1$, $-1$, $1$, ..., as $(-1)^{g(n)}$ or other closed form How to put mathematically sequence that changes sign like:
$n = 0\quad f = 1$
$n = 1 \quad f = -1$
$n = 2 \quad f = -1$
$n = 3 \quad f = 1$
$n = 4 \quad f = -1$
$n = 5 \quad f = -1$
$n = 6 \quad f = 1$
.....
In the form of (-1)^(something) or similar analytical expression.

\begin{align}
a_1 &=  1 \\
a_2 &= -1 \\
a_n &= a_{n-1}a_{n-2}
\end{align}
Using a product recurrence relation, we have
$$
a_n = a_2^{F_{n-1}}a_1^{F_{n-2}}
$$
Where $F_k$ is the $k$'th Fibonacci number. Given a closed form for $F_k$, we can simplify $a_n$.
$$
F_k = \frac{(1 + \sqrt{5})^k - (1 - \sqrt{5})^k}{2^k\sqrt{5}}
$$
$$
a_n = (-1)^{F_{n-1}} = (-1)^{\frac{(1 + \sqrt{5})^{n-1} - (1 - \sqrt{5})^{n-1}}{2^{n-1}\sqrt{5}}}
$$
This was solved so that the starting index of the sequence was $1$. If you want to start at $0$, we simply shift the index by $+1$.
$$
a_n = (-1)^{F_{n}} = (-1)^{\frac{(1 + \sqrt{5})^{n} - (1 - \sqrt{5})^{n}}{2^{n}\sqrt{5}}}
$$

Using Euler's Formula, we can get a far more (or less) elegant solution:
$$
a_n = (-1)^{F_n} = \cos(\pi F_n) + i\sin(\pi F_n) = e^{i\pi F_n}
$$
