%I #30 Jul 21 2017 17:34:01
%S 0,1,8,4,25,72,10,56,154,320,20,105,280,570,1000,35,176,459,920,1595,
%T 2520,56,273,700,1386,2380,3731,5488,84,400,1012,1984,3380,5264,7700,
%U 10752,120,561,1404,2730,4620,7155,10416,14484,19440
%N Triangle read by rows: T(n,k) is the Wiener index of a k X n grid (i.e., P_k X P_n, where P_m is the path graph on m vertices; 1 <= k <= n).
%C The Wiener index of a connected graph is the sum of distances between all unordered pairs of vertices in the graph.
%C This is the lower triangular half of a symmetric square array.
%H Michael De Vlieger, <a href="/A143368/b143368.txt">Table of n, a(n) for n = 1..11325</a> (rows 1 <= n <= 150).
%H A. Graovac and T. Pisanski, <a href="http://dx.doi.org/10.1007/BF01166923">On the Wiener index of a graph</a>, J. Math. Chem., 8 (1991), 53-62.
%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.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GridGraph.html">Grid Graph</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/WienerIndex.html">Wiener Index</a>
%F T(n,k) = k*n*(n+k)*(k*n-1)/6 (k, n >= 1).
%e Presentation as symmetric square array starts:
%e ======================================================
%e n\k| 1 2 3 4 5 6 7 8 9
%e ---|--------------------------------------------------
%e 1 | 0 1 4 10 20 35 56 84 120 ...
%e 2 | 1 8 25 56 105 176 273 400 561 ...
%e 3 | 4 25 72 154 280 459 700 1012 1404 ...
%e 4 | 10 56 154 320 570 920 1386 1984 2730 ...
%e 5 | 20 105 280 570 1000 1595 2380 3380 4620 ...
%e 6 | 35 176 459 920 1595 2520 3731 5264 7155 ...
%e 7 | 56 273 700 1386 2380 3731 5488 7700 10416 ...
%e 8 | 84 400 1012 1984 3380 5264 7700 10752 14484 ...
%e 9 | 120 561 1404 2730 4620 7155 10416 14484 19440 ...
%e ... - _Andrew Howroyd_, May 27 2017
%e T(2,2)=8 because in a square we have four distances equal to 1 and two distances equal to 2.
%e T(2,1)=1 because on the path graph on two vertices there is one distance equal to 1.
%e T(3,2)=25 because on the P(2) X P(3) graph there are 7 distances equal to 1, 6 distances equal to 2 and 2 distances equal to 3, with 7*1 + 6*2 + 2*3 = 25.
%e Triangle starts: 0; 1,8; 4,25,72; 10,56,154,320;
%p T:=proc(n, k) options operator, arrow: (1/6)*k*n*(n+k)*(k*n-1) end proc: for n to 9 do seq(T(n,k),k=1..n) end do; # yields sequence in triangular form
%t Table[k n (n + k) (k n - 1)/6, {n, 9}, {k, n}] // Flatten (* _Michael De Vlieger_, May 28 2017 *)
%o (PARI)
%o T(n,k)=k*n*(n+k)*(k*n-1)/6;
%o for (n=1,8,for(k=1,8,print1(T(n,k),", "));print) \\ _Andrew Howroyd_, May 27 2017
%Y Cf. A180569 (row 3), A131423 (row 2).
%Y Main diagonal is A143945.
%Y Cf. A245826.
%K nonn,tabl
%O 1,3
%A _Emeric Deutsch_, Sep 05 2008