Finding the $n^{\text{th}}$ term of $-1,-1,-1,-1,1,1,1,1,...$ as a repeating 8-block In my work I came across that sequence
$-1,-1,-1,-1,1,1,1,1,\dots$ and repeating this 8-block so on forever
Now I cant find an ( e.g. trigonometric/complex ) expression
$f(n)$ ( e.g. $f(n) =(-1)^g(n)$ ) which gives me the sequence starting with 
$n=2,3,4,5,6,7,8,9,…$
and so on forever.
 A: Consider the function $f(n)$ such that 
\begin{equation}
f(n) = \left \{ \begin{array}[ll] (-1 & \textrm{ if } n \textrm{ mod } 8 \equiv 0,1,2,3 \\ 1 & \textrm{ if } n \textrm{ mod } 8 \equiv 4,5,6,7 \end{array} \right. 
\end{equation}
A: I will assume that you really are starting at $2$. If the start is different, modification is easy.
Let $g(n)=\left\lfloor\frac{n+2}{4}\right\rfloor$. Here $\lfloor x\rfloor$ is the "floor" function, the greatest integer $\le x$.
Then your sequence is given by $(-1)^{g(n)}$.
A: By symmetry, we can assume
$$
f(n) =
a_1 \sin\frac{\pi n}{4}
+a_3 \sin\frac{3\pi n}{4}
+b_1 \cos\frac{\pi n}{4}
+b_3 \cos\frac{3\pi n}{4}.
$$
Then
$$
\begin{aligned}
f(1) &= \frac{a_1}{\sqrt{2}} +\frac{a_3}{\sqrt{2}} + \frac{b_1}{\sqrt{2}} -\frac{b_3}{\sqrt{2}} = -1\\
f(2) &= a_1 - a_3 = -1\\
f(3) &= \frac{a_1}{\sqrt{2}} +\frac{a_3}{\sqrt{2}} - \frac{b_1}{\sqrt{2}} +\frac{b_3}{\sqrt{2}} = -1 \\
f(4) &= -b_1 - b_3 = -1.
\end{aligned}
$$
So
$$
\begin{aligned}
a_1 &= -\frac{1}{2} -\frac{1}{\sqrt 2}, \\
a_3 &= +\frac{1}{2} -\frac{1}{\sqrt 2}, \\
b_1 &= b_3 = \frac{1}{2}.
\end{aligned}
$$
So
$$\begin{aligned}
f(n)
&=
\left( -\frac{1}{2} -\frac{1}{\sqrt 2} \right) \sin\frac{\pi n}{4}
+
\left(  \frac{1}{2} -\frac{1}{\sqrt 2} \right) \sin\frac{3 \pi n}{4}
+
\frac{1}{2} \left( \cos\frac{\pi n}{4} + \cos\frac{3 \pi n}{4} \right) \\
&=
\sin\frac{\pi n}{4} \cos\frac{\pi n}{2}
-\sqrt 2 \cos\frac{\pi n}{4} \sin\frac{\pi n}{2}
+
\cos\frac{\pi n}{4} \cos\frac{\pi n}{2} \\
&=
\sqrt 2 \left[ \sin\frac{\pi (n+1)}{4} \cos\frac{\pi n}{2}
- \cos\frac{\pi n}{4} \sin\frac{\pi n}{2} \right].
\end{aligned}
$$
A: Let $\zeta = \mathrm{e}^{\mathrm{i} \pi/4}$ and $$f(z) = \frac{1}{4} z \left(\left(\sqrt{2}+(1-\mathrm{i})\right) z^6
    +\left(-\sqrt{2}+(1+\mathrm{i})\right) z^4 \\
    -\left(\sqrt{2}+(-1+\mathrm{i})\right) z^2
    +\sqrt{2}+(1+\mathrm{i})\right).$$
Then $f(\zeta^n)$ is your sequence.  (It even starts at $n=2$.)
Brought to you by the joys of Lagrange interpolation (on the eighth roots of $1$).
(I haven't worked through the details, but if we turn this into a trigonometric expression, it looks as if we should get something close to @user293511's answer.)
A: Modified to start at $n=2$:$$f(n)=(-1)^{\frac{(n+2)!}{(n-2)!4!}}$$
This will give you your desired sequence.
Here is a plot of this function.
A: Simply observe the 3rd bit
\begin{equation}
f(n) = \left \{ \begin{array}[ll] (-1 & \textrm{ if } n \land 2^3 \equiv 0 \\ 1 & \textrm{ if } n \land 2^3 \equiv 1 \end{array} \right. 
\end{equation}
Or (if my mathematical symbols are correct)
\begin{equation}
f(n) = 2 (n \land 2^3) - 1
\end{equation}
I'm trying to express the bit-wise logical and of n with the binary number 01000.
A: By adding a third harmonic to a sine wave I came up with $\sin{x}+(\sqrt2-1)\sin3x$ which has equal value at $x = \frac\pi8, 3\frac\pi8, 5\frac\pi8, 7\frac\pi8, 17\frac\pi8, \dots$ and the negative value at the corresponding missing odd coordinates. The formula does get more complicated when you normalise the values to be $\pm1$ for $n = 2\dots8$ though:
$$f(n) =\frac{\sin(\frac{2x+5}8\pi)+(\sqrt2-1)\sin(\frac{6x+15}8\pi)}{\sin\frac\pi{8}+(\sqrt2-1)\sin\frac{3\pi}8}$$
