%I #43 Feb 12 2023 12:30:52
%S 1,4,19,40,85,140,231,336,489,660,891,1144,1469,1820,2255,2720,3281,
%T 3876,4579,5320,6181,7084,8119,9200,10425,11700,13131,14616,16269,
%U 17980,19871,21824,23969,26180,28595,31080,33781,36556,39559,42640,45961,49364,53019,56760,60765
%N Partial sums of the odd triangular numbers (A014493).
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-4,1,2,-1).
%F a(n) = Sum_{k=1..n} A014493(k) = Sum_{k=1..n} (2*k-1)(2*k-1-(-1)^k)/2.
%F a(n) = A352115(n-1) + (-1)^(n-1)*n.
%F a(n) = A000447(n) - A352115(n-1).
%F From _Stefano Spezia_, Mar 05 2022: (Start)
%F a(n) = n*(4*n^2 - 1 - 3*(-1)^n)/6.
%F G.f.: x*(1 + 2*x + 10*x^2 + 2*x^3 + x^4)/((1 - x)^4*(1 + x)^2). (End)
%e a(1) = 1 because 1 is the first odd term in A000027.
%e a(2) = 1 + 3 = 4, the sum of the first two odd terms in A000027, and so on.
%t LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 4, 19, 40, 85, 140}, 50] (* _Amiram Eldar_, Mar 05 2022 *)
%o (PARI) to(n) = (2*n-1)*(2*n-1-(-1)^n)/2; \\ A014493
%o a(n) = sum(k=1, n, to(k)); \\ _Michel Marcus_, Mar 05 2022
%o (Python)
%o def A352116(n): return n*((n-1)<<1)*(n+1)//3 + n*(n&1) # _Chai Wah Wu_, Feb 12 2023
%Y Cf. A001477, A000217, A000292, A014493, A014494, A352115, A000447.
%K nonn,easy
%O 1,2
%A _David James Sycamore_, Mar 05 2022
%E More terms from _Michel Marcus_, Mar 05 2022