A323724 a(n) = n*(2*(n - 2)*n + (-1)^n + 3)/4.
0, 0, 2, 6, 20, 40, 78, 126, 200, 288, 410, 550, 732, 936, 1190, 1470, 1808, 2176, 2610, 3078, 3620, 4200, 4862, 5566, 6360, 7200, 8138, 9126, 10220, 11368, 12630, 13950, 15392, 16896, 18530, 20230, 22068, 23976, 26030, 28158, 30440, 32800, 35322, 37926, 40700
Offset: 0
Links
- Stefano Spezia, Table of n, a(n) for n = 0..10000
- Christian Krause, LODA, an assembly language, a computational model and a tool for mining integer sequences
- Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
Programs
-
GAP
Flat(List([0..50], n->(1/2)*(-1 + n)^2*n - (-1 + n)*Int(n/2) + 2*(Int(n/2))^2));
-
Magma
[(1/2)*(-1 + n)^2*n - (-1 + n)*Floor(n/2) + 2*(Floor(n/2))^2: n in [0..50]];
-
Maple
a:=n->(1/2)*(-1 + n)^2*n - (-1 + n)*floor(n/2) + 2*(floor(n/2))^2: seq(a(n), n=0..50);
-
Mathematica
a[n_] := 1/2 (-1 + n)^2 n - (-1 + n) Floor[n/2] + 2 Floor[n/2]^2; Array[a, 50, 0]; Table[n (2 (n - 2) n + (-1)^n + 3)/4, {n, 0, 50}] (* Bruno Berselli, Feb 06 2019 *) LinearRecurrence[{2,1,-4,1,2,-1},{0,0,2,6,20,40},50] (* Harvey P. Dale, Jan 13 2024 *)
-
Maxima
makelist((1/2)*(-1 + n)^2*n - (-1 + n)*floor(n/2) + 2*(floor(n/2))^2, n, 0, 50);
-
PARI
a(n) = (1/2)*(-1 + n)^2*n - (-1 + n)*floor(n/2) + 2*(floor(n/2))^2;
-
PARI
T(i,j,n) = if (i %2, j + n*(i-1), n*i - j + 1); a(n) = sum(k=1, n-1, T(k,k+1,n)); \\ Michel Marcus, Feb 06 2019
-
Python
[int((1/2)*(-1 + n)**2*n - (-1 + n)*int(n/2) + 2*(int(n/2))**2) for n in range(0,50)]
Formula
O.g.f.: 2*x^2*(1 + x + 3*x^2 + x^3)/((1 - x)^4*(1 + x)^2).
E.g.f.: (1/2)*x*(exp(x)*x*(1 + x) + sinh(x)).
a(n) = 2*a(n-1) + a(n-2) - 4*a(n-3) + a(n-4) + 2*a(n-5) - a(n-6) for n > 5.
a(n) = (1/2)*(-1 + n)^2*n - (-1 + n)*floor(n/2) + 2*floor(n/2)^2.
a(n) = (n/2)*((n - 1)^2 + 1) for even n; a(n) = (n/2)*(n - 1)^2 otherwise. - Bruno Berselli, Feb 06 2019
a(n) = 2*A004526(n*A000982(n-1)). [Found by Christian Krause's LODA miner] - Stefano Spezia, Dec 12 2021
a(n) = 2*A005997(n-1) for n >= 2. - Hugo Pfoertner, Dec 13 2021
Extensions
Definition by Bruno Berselli, Feb 06 2019
Comments