若n为偶数,则Sn=1^2-2^2+3^2-4^2+……+(-1)^(n+1) n^2
=(1-2)(1+2)+(3-4)(3+4)+(5-6)(5+6)+……+((n-1)-n)((n-1)+n)
=-(1+2+3+4+……+n-1+n)
=-(n+1)n/2,
若n为奇数,则Sn=1^2-2^2+3^2-4^2++(-1)^(n+1) n^2
=1+(3-2)(3+2)+(5-4)(5+4)+……+(n-(n-1))(n+(n-1))
=1+2+3+4+……+n-1+n
=(n+1)n/2
综上可知Sn=(-1)^(n+1) (n+1)n/2.