The general term of the sequence : 1, 1, -1, -1, 1, 1, ...? Suppose we have the following sequence:
{$a_n$} such as:
$a_0 = 1, \\
a_1 = 1, \\
a_2 = -1, \\
a_3 = -1, \\
a_4 = 1, \\
a_5 = 1, \\
...
$
How can we find the general term of this sequence? I tried using a trigonometric function e.g. $\alpha \sin(x+\phi)$, then we impose some constraints on $\alpha$ and $\phi$ to get that sequence, but I get lost, is there any clever way to find the general term?
EDIT: The question is identified as duplicate, but that answer does not solve the question, because I am looking for a solution that does not involve floor function.
 A: $$(-1)^{\lfloor{n/2}\rfloor},$$ where $\lfloor{\cdot}\rfloor$ is the floor function, or as requested in the comment, $$\sqrt{2}\cdot\sin\big((2n+1)\pi/4\big).$$
A: The general solution of the recurrence $\ a_n=a_{n-4}\ $ is
$$a_n=Ai^n+B(-1)^n+C(-i)^n+D$$
where $A,B,C,D$ are arbitrary constants.
The particular solution for your initial values $\ a_0=a_1=1,\ a_2=a_3=-1\ $ is
$$a_n=\frac{(1-i)i^n+(1+i)(-i)^n}2.$$
Using the identities $i^n=e^{n\pi i/2}=\cos\frac{n\pi}2+i\sin\frac{n\pi}2$ and $(-i)^n=e^{-n\pi i/2}=\cos\frac{n\pi}2-i\sin\frac{n\pi}2$
we can rewrite this as
$$a_n=\cos\frac{n\pi}2+\sin\frac{n\pi}2.$$
A: You could use $\cos(n\pi/2)+\sin(n\pi/2)$. I see this working by thinking about the unit circle. A needle pointing East, North, West, or South always contributes a $0$ from among $\cos(n\pi/2),\sin(n\pi/2)$ and also either $1$ or $-1$. And it just works out.
Trig identities show this is equal to to $\sqrt{2}\sin(n\pi/2+\pi/4)$
Or from a different perspective, $(-1)^{n(n-1)/2}$. The expression $n(n-1)$ is always even, so always divisible by $2$. Sometimes, one of $n,n-1$ is also divisible by $4$, so that you still have an even number after dividing by $2$. As $n$ iterates, first $n$ will be divisible by $4$, then $n-1$ will be divisible by $4$, then $n$ will be divisible only by $2$, then $n-1$ will be divisible only by $2$. And then it all repeats. So the exponent on $(-1)$ is even, even, odd, odd, repeat.
