OFFSET
0,2
COMMENTS
The absolute difference between the n-th partial sum of the odd triangular numbers and the (n-1)-th partial sum of the even triangular numbers is equal to n; see formula.
Partial sums of the even generalized hexagonal numbers. - Omar E. Pol, Mar 05 2022
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
a(n) = Sum_{k=0..n-1} A014494(k) = Sum_{k=0..n-1} (2*k+1)(2*k+1-(-1)^k)/2.
|A352116(n) - a(n-1)| = n.
From Stefano Spezia, Mar 05 2022: (Start)
a(n) = (n + 1)*(4*n^2 + 8*n + 3 - 3*(-1)^n)/6.
G.f.: 2*x*(3 + 2*x + 3*x^2)/((1 - x)^4*(1 + x)^2). (End)
EXAMPLE
MATHEMATICA
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {0, 6, 16, 44, 80, 146}, 50] (* Amiram Eldar, Mar 05 2022 *)
PROG
(PARI) te(n) = (2*n+1)*(2*n+1-(-1)^n)/2; \\ A014494
a(n) = sum(k=0, n, te(k)); \\ Michel Marcus, Mar 06 2022
(Python)
def A352115(n): return (n + 1)*(2*n*(n+2) + 3*(n%2))//3 # Chai Wah Wu, Mar 11 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
David James Sycamore, Mar 05 2022
STATUS
approved