%I #156 Apr 09 2023 14:42:48
%S 1,4,15,32,65,108,175,256,369,500,671,864,1105,1372,1695,2048,2465,
%T 2916,3439,4000,4641,5324,6095,6912,7825,8788,9855,10976,12209,13500,
%U 14911,16384,17985,19652,21455,23328,25345,27436,29679,32000,34481,37044,39775,42592
%N a(n) = (1/2)*(n^3 + n*(n mod 2)).
%C 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).
%C 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).
%C From _Saeed Barari_, Oct 31 2021: (Start)
%C 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:
%C 1 2 3 2 1
%C 2 3 4 3 2
%C 3 4 5 4 3
%C 2 3 4 3 2
%C 1 2 3 2 1. (End)
%C 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
%D Edward A. Ashcroft, Anthony A. Faustini, Rangaswami Jagannathan, William W. Wadge, Multidimensional Programming, Oxford University Press 1995, p. 12.
%D G. Polya, Mathematics and Plausible Reasoning: Induction and analogy in mathematics, Princeton University Press 1990, p. 118.
%D Shailesh Shirali, A Primer on Number Sequences, Universities Press (India) 2004, p. 106.
%H Stefano Spezia, <a href="/A317614/b317614.txt">Table of n, a(n) for n = 0..10000</a>
%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) = (1/2)*(A000578(n) + n*A000035(n)).
%F a(n) = A006003(n) - (n/2)*(1 - (n mod 2)).
%F 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)).
%F 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).
%F L.g.f.: L(x) = -x*(1 + x^2)/((-1 + x)*(1 + x)^3).
%F H.l.g.f.: LH(x) = -x*(1 + x^2)/((-1 + x)^3*(1 + x)).
%F Dirichlet g.f.: (1/2)*(Zeta(-3 + s) + 2^(-s)*(-2 + 2^s)*Zeta(-1 + s)).
%F From _Colin Barker_, Aug 02 2018: (Start)
%F G.f.: x*(1 + 2*x + 6*x^2 + 2*x^3 + x^4) / ((1 - x)^4*(1 + x)^2).
%F 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.
%F a(n) = n^3/2 for n even.
%F a(n) = (n^3+n)/2 for n odd.
%F (End)
%F a(2*n) = A317297(n+1) + A001489(n). - _Stefano Spezia_, Dec 28 2018
%F 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
%F a(n) = (A000578(n) + A193356(n))/2. - _Stefano Spezia_, Jun 27 2022
%e For n = 1 the matrix M(1) is
%e 1
%e with trace Tr(M(1)) = a(1) = 1.
%e For n = 2 the matrix M(2) is
%e 1, 2
%e 4, 3
%e with Tr(M(2)) = a(2) = 4.
%e For n = 3 the matrix M(3) is
%e 1, 2, 3
%e 6, 5, 4
%e 7, 8, 9
%e with Tr(M(3)) = a(3) = 15.
%p a:=n->(1/2)*(n^3+n*modp(n,2)): seq(a(n),n=1..50); # _Muniru A Asiru_, Aug 24 2018
%t 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}]
%t CoefficientList[Series[-(1 + x^2)/((-1 + x)*(1 + x)^3), {x, 0, 45}], x]*Table[(k + 1)*(-1)^k, {k, 0, 45}]
%t CoefficientList[Series[-(1 + x^2)/((-1 + x)^3*(1 + x)), {x, 0, 45}], x]*Table[(k + 1), {k, 0, 45}]
%t From _Robert G. Wilson v_, Aug 01 2018: (Start)
%t 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]
%t CoefficientList[Series[(x^4 + 2x^3 + 6x^2 + 2x + 1)/((x - 1)^4 (x + 1)^2), {x, 0,
%t 45}], x]
%t LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 4, 15, 32, 65, 108}, 45]
%t (End)
%o (R)
%o for (n in 1:nmax){
%o a <- (n^3+n*n%%2)/2
%o output <- c(n, a)
%o cat(output, "\n")
%o }
%o (MATLAB and FreeMat)
%o for(n=1:nmax); a=(n^3+n*mod(n,2))/2; fprintf('%d\t%0.f\n',n,a); end
%o (GAP) a_n:=List([1..nmax], n->(1/2)*(n^3 + n*RemInt(n, 2)));
%o (Maxima) a(n):=(1/2)*(n^3 + n*mod(n,2))$ makelist(a(n), n, 1, nmax);
%o (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
%o (PARI) M(i, j, n) = if (i % 2, j + n*(i-1), n*i - j + 1);
%o a(n) = sum(k=1, n, M(k, k, n)); \\ _Michel Marcus_, Aug 07 2018
%o (Magma) [IsEven(n) select n^3/2 else (n^3+n)/2: n in [1..50]]; // _Vincenzo Librandi_, Aug 07 2018
%o (GAP) List([1..50],n->(1/2)*(n^3+n*(n mod 2))); # _Muniru A Asiru_, Aug 24 2018
%Y Cf. A000583, A000027, A186424 (first differences).
%Y Cf. A000578, A000035, A193356.
%Y Cf. A006003, A317297, A001489, A322844.
%Y Cf. related to the M matrices: A074147 (antidiagonals), A130130 (rank), A241016 (row sums), A317617 (column sums), A322277 (permanent), A323723 (subdiagonal sums), A323724 (superdiagonal sums).
%K nonn,easy
%O 1,2
%A _Stefano Spezia_, Aug 01 2018
|