%I #13 Aug 23 2024 08:39:56
%S 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,
%T 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,
%U 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
%N 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.
%C Row n has 2n entries.
%C The entries in row n are the coefficients of the Wiener polynomial of the linear chain of n squares.
%C Sum of entries in row n = 3n(3n+1)/2 = A081266(n).
%C Sum_{k=1..n} k*T(n,k) = the Wiener index of a linear chain of n squares joined at vertices (like <><><>...) = A143943(n).
%H B. E. Sagan, Y-N. Yeh and P. Zhang, <a href="http://dx.doi.org/10.1002/(SICI)1097-461X(1996)60:5<959::AID-QUA2>3.0.CO;2-W">The Wiener Polynomial of a Graph</a>, Internat. J. of Quantum Chem., 60, 1996, 959-969.
%F T(n,1) = 4n; T(n,2) = 6n-4; T(n,2p+1) = 4(n-p); T(n,2p) = 5(n-p)+1.
%F G.f. = G(q,z) = qz/(4+2q+4qz-q^3*z)/((1-q^2*z)*(1-z)^2).
%e T(2,1)=8 because the chain of 2 squares (<><>) has 8 edges.
%e Triangle starts:
%e 4, 2;
%e 8, 8, 4, 1;
%e 12, 14, 8, 6, 4, 1;
%e 16, 20, 12, 11, 8, 6, 4, 1;
%e 20, 26, 16, 16, 12, 11, 8, 6, 4, 1;
%p 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
%t 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];
%t Table[T[n, k], {n, 1, 10}, {k, 1, 2n}] // Flatten (* _Jean-François Alcover_, Aug 23 2024, after Maple program *)
%Y Cf. A081266, A143943.
%K nonn,tabf
%O 1,1
%A _Emeric Deutsch_, Sep 06 2008