login
A089594
Alternating sum of squares to n.
13
-1, 3, -6, 10, -15, 21, -28, 36, -45, 55, -66, 78, -91, 105, -120, 136, -153, 171, -190, 210, -231, 253, -276, 300, -325, 351, -378, 406, -435, 465, -496, 528, -561, 595, -630, 666, -703, 741, -780, 820, -861, 903, -946, 990, -1035, 1081, -1128, 1176, -1225, 1275
OFFSET
1,2
COMMENTS
Let A be the Hessenberg n X n matrix defined by: A[1,j]=j mod 2, A[i,i]:=1, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=3, a(n-1)=(-1)^(n-1)*coeff(charpoly(A,x),x^(n-2)). - Milan Janjic, Jan 24 2010
Also triangular numbers with alternating signs. - Stanislav Sykora, Nov 26 2013
FORMULA
From R. J. Mathar, Nov 05 2011: (Start)
a(n) = Sum_{i=1..n} (-1)^i*i^2 = (-1)^n*n*(n+1)/2.
G.f.: -x / (1+x)^3. (End)
a(n) = (-1)^n*det(binomial(i+2,j+1), 1 <= i,j <= n-1). - Mircea Merca, Apr 06 2013
G.f.: -W(0)/(2+2*x), where W(k) = 1 + 1/( 1 - x*(k+2)/( x*(k+2) - (k+1)/W(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Aug 19 2013
E.g.f.: (1/2)*x*(x-2)*exp(-x). - G. C. Greubel, Mar 31 2021
Sum_{n>=1} 1/a(n) = 2 - 4*log(2). - Amiram Eldar, Jan 31 2023
EXAMPLE
a(6) = 1 + 4 - 9 + 16 - 25 + 36 = 3 + 7 + 11 = 21.
MAPLE
seq(sum(binomial(n, m), m=1..2)-n^2, n=2..51); # Zerinvary Lajos, Jun 19 2008
A089594 := n -> (-1)^n*n*(n+1)/2; # Peter Luschny, Jul 08 2011
MATHEMATICA
nn = Range[50]; Accumulate[(-1)^nn*nn^2] (* Jayanta Basu, Jun 06 2013 *)
PROG
(PARI) for(i=1, 50, print1(", "sum(j=1, i, (-1)^j*j^2)))
(PARI) a(n)=(-1)^n*n*(n+1)/2 \\ Charles R Greathouse IV, Jul 08 2011
(Magma) [(-1)^n*n*(n+1)/2: n in [1..50]]; // Vincenzo Librandi, Nov 16 2011
(Sage) [(-1)^n*binomial(n+1, 2) for n in (1..50)] # G. C. Greubel, Mar 31 2021
CROSSREFS
Cf. A059841 (p=0,q=-1), A130472 (p=1,q=-1), this sequence (p=2,q=-1), A232599 (p=3,q=-1), A126646 (p=0,q=2), A036799 (p=1,q=2), A036800 (p=2,q=2), A036827 (p=3,q=2), A077925 (p=0,q=-2), A232600 (p=1,q=-2), A232601 (p=2,q=-2), A232602 (p=3,q=-2), A232603 (p=2,q=-1/2), A232604 (p=3,q=-1/2).
Cf. A000217.
Cf. A225144. [Bruno Berselli, Jun 06 2013]
Sequence in context: A105337 A105338 A105339 * A253145 A161680 A000217
KEYWORD
sign,easy
AUTHOR
Jon Perry, Dec 30 2003
STATUS
approved