OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
a(n) = Sum_{k=1..n} A014493(k) = Sum_{k=1..n} (2*k-1)(2*k-1-(-1)^k)/2.
a(n) = A352115(n-1) + (-1)^(n-1)*n.
From Stefano Spezia, Mar 05 2022: (Start)
a(n) = n*(4*n^2 - 1 - 3*(-1)^n)/6.
G.f.: x*(1 + 2*x + 10*x^2 + 2*x^3 + x^4)/((1 - x)^4*(1 + x)^2). (End)
EXAMPLE
MATHEMATICA
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 4, 19, 40, 85, 140}, 50] (* Amiram Eldar, Mar 05 2022 *)
PROG
(PARI) to(n) = (2*n-1)*(2*n-1-(-1)^n)/2; \\ A014493
a(n) = sum(k=1, n, to(k)); \\ Michel Marcus, Mar 05 2022
(Python)
def A352116(n): return n*((n-1)<<1)*(n+1)//3 + n*(n&1) # Chai Wah Wu, Feb 12 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
David James Sycamore, Mar 05 2022
EXTENSIONS
More terms from Michel Marcus, Mar 05 2022
STATUS
approved