Explicit (or recursive) formula of a sequence Is there an explicit or recursive formula for this sequence starting from n=1:
1, -1 , -1 , 1 , 1 , -1 , -1 , 1 , 1 , -1 , -1 , 1 , 1 , -1 , -1 , 1 , 1 , ...
 A: One formula is this:
$$
a_n = \frac{2}{\sqrt{2}}\cos(\frac{n\pi}{4})
$$
A: $$a_n=(-1)^{\displaystyle\sum\limits_{i=0}^ni}=(-1)^{\dfrac{n(n+1)}2}.$$
You start with $0$, $(-1)^0$ is of course $1$. Then you move on to $1$, which is odd. You then add $2$, you'll still get an odd number. In both cases $-1$ to the power of an odd number will be $-1$. When you add now $3$ you get an even number, hence you'll get $1$. When you add ... You get the point. In blue even numbers, and in green odd numbers :
$$
\color{royalblue}0\,\boldsymbol,\,\color{green}1\,\boldsymbol,\,\color{green}{1+2}\,\boldsymbol,\,\color{royalblue}{1+2+3}\,\boldsymbol,\,\color{royalblue}{1+2+3+4}\,\boldsymbol,\,\color{green}{1+2+3+4+5}\,\boldsymbol,\,\ldots
$$
So the idea behind it comes from noting that you need to add two consecutive whole numbers to change the parity of your sum.
A: For a recursive formula, you could use initial terms $a_1=1$ and $a_2=-1$, then use an order 2 linear recurrence to describe the rest of the sequence.  (I'll leave it as an exercise to figure out the exact recurrence).
