cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A317614 a(n) = (1/2)*(n^3 + n*(n mod 2)).

Original entry on oeis.org

1, 4, 15, 32, 65, 108, 175, 256, 369, 500, 671, 864, 1105, 1372, 1695, 2048, 2465, 2916, 3439, 4000, 4641, 5324, 6095, 6912, 7825, 8788, 9855, 10976, 12209, 13500, 14911, 16384, 17985, 19652, 21455, 23328, 25345, 27436, 29679, 32000, 34481, 37044, 39775, 42592
Offset: 1

Views

Author

Stefano Spezia, Aug 01 2018

Keywords

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

Examples

			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.
		

References

  • Edward A. Ashcroft, Anthony A. Faustini, Rangaswami Jagannathan, and William W. Wadge, Multidimensional Programming, Oxford University Press 1995, p. 12.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 64.
  • 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.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, Exercise 3.7.3 on pages 122-123.

Crossrefs

Cf. A000583, A000027, A186424 (first differences).
Cf. related to the M matrices: A074147 (antidiagonals), A130130 (rank), A241016 (row sums), A317617 (column sums), A322277 (permanent), A323723 (subdiagonal sums), A323724 (superdiagonal sums).

Programs

  • GAP
    a_n:=List([1..nmax], n->(1/2)*(n^3 + n*RemInt(n, 2)));
    
  • GAP
    List([1..50],n->(1/2)*(n^3+n*(n mod 2))); # Muniru A Asiru, Aug 24 2018
  • Magma
    [IsEven(n) select n^3/2 else (n^3+n)/2: n in [1..50]]; // Vincenzo Librandi, Aug 07 2018
    
  • 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)
  • 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
    
  • 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
    

Formula

a(n) = (1/2)*(A000578(n) + n*A000035(n)).
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)
a(2*n) = A317297(n+1) + A001489(n). - Stefano Spezia, Dec 28 2018
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) = (A000578(n) + A193356(n))/2. - Stefano Spezia, Jun 27 2022
a(n) = A210378(n-1)/n. - Stefano Spezia, Jul 15 2024