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.

A143942 Triangle read by rows: T(n,k) is the number of unordered pairs of vertices at distance k in a linear chain of n squares joined at vertices (i.e., joined like <><><>...<>; here <> is a square!); 1 <= k <= 2n.

Original entry on oeis.org

4, 2, 8, 8, 4, 1, 12, 14, 8, 6, 4, 1, 16, 20, 12, 11, 8, 6, 4, 1, 20, 26, 16, 16, 12, 11, 8, 6, 4, 1, 24, 32, 20, 21, 16, 16, 12, 11, 8, 6, 4, 1, 28, 38, 24, 26, 20, 21, 16, 16, 12, 11, 8, 6, 4, 1, 32, 44, 28, 31, 24, 26, 20, 21, 16, 16, 12, 11, 8, 6, 4, 1, 36, 50, 32, 36, 28, 31, 24, 26
Offset: 1

Views

Author

Emeric Deutsch, Sep 06 2008

Keywords

Comments

Row n has 2n entries.
The entries in row n are the coefficients of the Wiener polynomial of the linear chain of n squares.
Sum of entries in row n = 3n(3n+1)/2 = A081266(n).
Sum_{k=1..n} k*T(n,k) = the Wiener index of a linear chain of n squares joined at vertices (like <><><>...) = A143943(n).

Examples

			T(2,1)=8 because the chain of 2 squares (<><>) has 8 edges.
Triangle starts:
   4,  2;
   8,  8,  4,  1;
  12, 14,  8,  6,  4,  1;
  16, 20, 12, 11,  8,  6,  4,  1;
  20, 26, 16, 16, 12, 11,  8,  6,  4,  1;
		

Crossrefs

Programs

  • Maple
    T:=proc(n,k) if 2*n < k then 0 elif k = 1 then 4*n elif k = 2 then 6*n-4 elif `mod`(k,2)=1 then 4*n-2*k+2 elif `mod`(k,2)=0 then 5*n-(5/2)*k+1 else 0 end if end proc: for n to 10 do seq(T(n,k),k=1..2*n) end do; # yields sequence in triangular form
  • Mathematica
    T[n_, k_] := Which[2n < k, 0, k == 1, 4n, k == 2, 6n - 4, OddQ[k], 4n - 2k + 2, EvenQ[k], 5n - (5/2) k + 1, True, 0];
    Table[T[n, k], {n, 1, 10}, {k, 1, 2n}] // Flatten (* Jean-François Alcover, Aug 23 2024, after Maple program *)

Formula

T(n,1) = 4n; T(n,2) = 6n-4; T(n,2p+1) = 4(n-p); T(n,2p) = 5(n-p)+1.
G.f. = G(q,z) = qz/(4+2q+4qz-q^3*z)/((1-q^2*z)*(1-z)^2).