a1=f(1)+f(2)
a2=f(2)+f(3)
a3=f(3)+f(4)
..
an=f(n)+f(n+1)
Sn=f(1)+f(n+1)+2*[(f(n)+f(n-1))+(f(n-2)+f(n-3))+..+(f(3)+f(2))]
n奇数 f(n)+f(n-1)=n^2-(n-1)^2=2n-1
Sn=1-(n+1)^2+2*[(2n-1)+(2n-3)+...+5]=1-(n+1)^2+(2n-1+5)*(2n-1-5)/2=1-(n+1)^2+(2n+4)(n-3)
=1-(n+1)^2+(2n^2-2n-12)
n偶数 f(n)+f(n-1)=-n^2+(n-1)^2=1-2n
Sn=1+(n+1)^2+2*[(1-2n)+(3-2n)+..+5]
=1+(n+1)^2+(6-2n)(-n-2)
=1+(n+1)^2+(2n^2-2n-12)