OFFSET
1,2
COMMENTS
Terms are obtained as partial sums in an algorithm for the generation of the sequence of the fourth powers (A000583). Starting with the sequence of the positive integers (A000027), it is necessary to delete every 4th term and to consider the partial sums of the obtained sequence, then to delete every 3rd term, and lastly to consider again the partial sums (see References).
a(n) is the trace of an n X n square matrix M(n) formed by writing the numbers 1, ..., n^2 successively forward and backward along the rows in zig-zag pattern as shown in the examples below. Specifically, M(n) is defined as M[i,j,n] = j + n*(i-1) if i is odd and M[i,j,n] = n*i - j + 1 if i is even, and it has det(M(n)) = 0 for n > 2 (proved).
From Saeed Barari, Oct 31 2021: (Start)
Also the sum of the entries in an n X n matrix whose elements start from 1 and increase as they approach the center. For instance, in case of n=5, the entries of the following matrix sum to 65:
1 2 3 2 1
2 3 4 3 2
3 4 5 4 3
2 3 4 3 2
1 2 3 2 1. (End)
The n X n square matrix of the preceding comment is defined as: A[i,j,n] = n - abs((n + 1)/2 - j) - abs((n + 1)/2 - i). - Stefano Spezia, Nov 05 2021
REFERENCES
Edward A. Ashcroft, Anthony A. Faustini, Rangaswami Jagannathan, William W. Wadge, Multidimensional Programming, Oxford University Press 1995, p. 12.
G. Polya, Mathematics and Plausible Reasoning: Induction and analogy in mathematics, Princeton University Press 1990, p. 118.
Shailesh Shirali, A Primer on Number Sequences, Universities Press (India) 2004, p. 106.
LINKS
Stefano Spezia, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
a(n) = A006003(n) - (n/2)*(1 - (n mod 2)).
a(n) = Sum_{k=1..n} T(n,k), where T(n,k) = ((n + 1)*k - n)*(n mod 2) + ((n - 1)*k + 1)*(1 - (n mod 2)).
E.g.f.: E(x) = (1/4)*exp(-x)*x*(1 + 3*exp(2*x) + 6*exp(2*x)*x + 2*exp(2*x)*x^2).
L.g.f.: L(x) = -x*(1 + x^2)/((-1 + x)*(1 + x)^3).
H.l.g.f.: LH(x) = -x*(1 + x^2)/((-1 + x)^3*(1 + x)).
Dirichlet g.f.: (1/2)*(Zeta(-3 + s) + 2^(-s)*(-2 + 2^s)*Zeta(-1 + s)).
From Colin Barker, Aug 02 2018: (Start)
G.f.: x*(1 + 2*x + 6*x^2 + 2*x^3 + x^4) / ((1 - x)^4*(1 + x)^2).
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>6.
a(n) = n^3/2 for n even.
a(n) = (n^3+n)/2 for n odd.
(End)
Sum_{n>0} 1/a(n) = (1/2)*(-2*polygamma(0, 1/2) + polygamma(0, (1-i)/2)+ polygamma(0, (1+i)/2)) + zeta(3)/4 approximately equal to 1.3959168891658447368440622669882813003351669... - Stefano Spezia, Feb 11 2019
a(n) = A210378(n-1)/n. - Stefano Spezia, Jul 15 2024
EXAMPLE
For n = 1 the matrix M(1) is
1
with trace Tr(M(1)) = a(1) = 1.
For n = 2 the matrix M(2) is
1, 2
4, 3
with Tr(M(2)) = a(2) = 4.
For n = 3 the matrix M(3) is
1, 2, 3
6, 5, 4
7, 8, 9
with Tr(M(3)) = a(3) = 15.
MAPLE
a:=n->(1/2)*(n^3+n*modp(n, 2)): seq(a(n), n=1..50); # Muniru A Asiru, Aug 24 2018
MATHEMATICA
CoefficientList[Series[1/4 E^-x (1 + 3 E^(2 x) + 6 E^(2 x) x + 2 E^(2 x) x^2), {x, 0, 45}], x]*Table[(k + 1)!, {k, 0, 45}]
CoefficientList[Series[-(1 + x^2)/((-1 + x)*(1 + x)^3), {x, 0, 45}], x]*Table[(k + 1)*(-1)^k, {k, 0, 45}]
CoefficientList[Series[-(1 + x^2)/((-1 + x)^3*(1 + x)), {x, 0, 45}], x]*Table[(k + 1), {k, 0, 45}]
From Robert G. Wilson v, Aug 01 2018: (Start)
a[i_, j_, n_] := If[OddQ@ i, j + n (i - 1), n*i - j + 1]; f[n_] := Tr[Table[a[i, j, n], {i, n}, {j, n}]]; Array[f, 45]
CoefficientList[Series[(x^4 + 2x^3 + 6x^2 + 2x + 1)/((x - 1)^4 (x + 1)^2), {x, 0,
45}], x]
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 4, 15, 32, 65, 108}, 45]
(End)
PROG
(R)
for (n in 1:nmax){
a <- (n^3+n*n%%2)/2
output <- c(n, a)
cat(output, "\n")
}
(MATLAB and FreeMat)
for(n=1:nmax); a=(n^3+n*mod(n, 2))/2; fprintf('%d\t%0.f\n', n, a); end
(GAP) a_n:=List([1..nmax], n->(1/2)*(n^3 + n*RemInt(n, 2)));
(Maxima) a(n):=(1/2)*(n^3 + n*mod(n, 2))$ makelist(a(n), n, 1, nmax);
(PARI) Vec(x*(1 + 2*x + 6*x^2 + 2*x^3 + x^4) / ((1 - x)^4*(1 + x)^2) + O(x^40)) \\ Colin Barker, Aug 02 2018
(PARI) M(i, j, n) = if (i % 2, j + n*(i-1), n*i - j + 1);
a(n) = sum(k=1, n, M(k, k, n)); \\ Michel Marcus, Aug 07 2018
(Magma) [IsEven(n) select n^3/2 else (n^3+n)/2: n in [1..50]]; // Vincenzo Librandi, Aug 07 2018
(GAP) List([1..50], n->(1/2)*(n^3+n*(n mod 2))); # Muniru A Asiru, Aug 24 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Stefano Spezia, Aug 01 2018
STATUS
approved