A352116 Partial sums of the odd triangular numbers (A014493).
1, 4, 19, 40, 85, 140, 231, 336, 489, 660, 891, 1144, 1469, 1820, 2255, 2720, 3281, 3876, 4579, 5320, 6181, 7084, 8119, 9200, 10425, 11700, 13131, 14616, 16269, 17980, 19871, 21824, 23969, 26180, 28595, 31080, 33781, 36556, 39559, 42640, 45961, 49364, 53019, 56760, 60765
Offset: 1
Examples
a(1) = 1 because 1 is the first odd term in A000027. a(2) = 1 + 3 = 4, the sum of the first two odd terms in A000027, and so on.
Links
- Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
Programs
-
Mathematica
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 4, 19, 40, 85, 140}, 50] (* Amiram Eldar, Mar 05 2022 *)
-
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
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)
Extensions
More terms from Michel Marcus, Mar 05 2022
Comments