<s>[INST] proving that $S_{2n}=3n^2+n,S_{2n+1}=3n^2+5n+1$ Given $a_n=\frac{1}{2}(-1)^n(2-n)+\frac{3n}{2}$
Need to show that $S_{2n}=3n^2+n,S_{2n+1}=3n^2+5n+1$.
I tired to separate $a_n$ to odd and even but something went wrong.
Thanks.
 [/INST] We have
$$A_{2n-1}=1+3+\dots+2n-1=n^2,$$
$$A_{2n}=2+4+\dots+2n=n^2+n.$$
Also, 
\begin{eqnarray}
a_n&=&\frac{(-1)^n}{2}(2-n)+\frac{3n}{2},\\
a_n&=&\frac{(-1)^n}{2}\cdot 2-\frac{(-1)^n}{2}\cdot n+\frac{3n}{2},\\
a_n&=&\frac{(-1)^n}{2}\cdot 2+\frac{3-(-1)^n}{2}\cdot n,\\
a_n&=&(-1)^n+\frac{3-(-1)^n}{2}\cdot n,
\end{eqnarray}
from where we get $a_{2k-1}=-1+2\cdot(2k-1)$ and $a_{2k}=1+2k$.
Therefore, 
$$a_1+a_3\dots+a_{2n-1}=(-1+2\cdot 1)+(-1+2\cdot 3)+\dots+(-1+2\cdot (2n-1)),$$
$$a_1+a_3\dots+a_{2n-1}=n\cdot (-1)+2\cdot (1+3+\dots+2n-1)=-n+2 A_{2n-1}$$
and similarly
$$a_2+a_4\dots+a_{2n}=(1+2)+(1+4)+\dots+(1+2n),$$
$$a_2+a_4\dots+a_{2n}=n\cdot 1+(2+4+\dots+2n)=n+A_{2n}$$
Finally,
$$S_{2n}=(a_1+a_3\dots+a_{2n-1})+(a_2+a_4+\dots+a_{2n}),$$
$$S_{2n}=(n\cdot(-1)+2\cdot A_{2n-1})+(n\cdot 1+A_{2n}),$$
$$S_{2n}=(-n+2\cdot n^2)+(2n+n^2)=3n^2+n$$
Since $S_{2n+1}=S_{2n}+a_{2n+1}$, $$S_{2n+1}=3n^2+n+4n+1=3n^2+5n+1.$$
</s>