login
Table read by antidiagonals: T(n, k) is the number of elements on the perimeter of an n X k matrix.
5

%I #97 May 23 2024 05:59:11

%S 1,2,2,3,4,3,4,6,6,4,5,8,8,8,5,6,10,10,10,10,6,7,12,12,12,12,12,7,8,

%T 14,14,14,14,14,14,8,9,16,16,16,16,16,16,16,9,10,18,18,18,18,18,18,18,

%U 18,10,11,20,20,20,20,20,20,20,20,20,11,12,22,22,22

%N Table read by antidiagonals: T(n, k) is the number of elements on the perimeter of an n X k matrix.

%C The table T(n, k) can be indifferently read by ascending or descending antidiagonals.

%F T(n, k) = n*k - (n - 2)*(k - 2)*H(min(n, k) - 3), where H(x) is the Heaviside step function, taking H(0) = 1.

%F G.f. as rectangular array: (x*y - x^3*y^3)/((-1 + x)^2*(-1 + y)^2).

%F X(n, k) = A131821(n, k)*A318274(n - 1, k)*A154325(n - 1, k). - _Franck Maminirina Ramaharo_, Nov 18 2018

%e The table T starts in row n=1 with columns k >= 1 as:

%e 1 2 3 4 5 6 7 8 9 10 ...

%e 2 4 6 8 10 12 14 16 18 20 ...

%e 3 6 8 10 12 14 16 18 20 22 ...

%e 4 8 10 12 14 16 18 20 22 24 ...

%e 5 10 12 14 16 18 20 22 24 26 ...

%e 6 12 14 16 18 20 22 24 26 28 ...

%e 7 14 16 18 20 22 24 26 28 30 ...

%e 8 16 18 20 22 24 26 28 30 32 ...

%e 9 18 20 22 24 26 28 30 32 34 ...

%e 10 20 22 24 26 28 30 32 34 36 ...

%e ...

%e The triangle X(n, k) begins

%e n\k| 1 2 3 4 5 6 7 8 9 10

%e ---+----------------------------------------

%e 1 | 1

%e 2 | 2 2

%e 3 | 3 4 3

%e 4 | 4 6 6 4

%e 5 | 5 8 8 8 5

%e 6 | 6 10 10 10 10 6

%e 7 | 7 12 12 12 12 12 7

%e 8 | 8 14 14 14 14 14 14 8

%e 9 | 9 16 16 16 16 16 16 16 9

%e 10 | 10 18 18 18 18 18 18 18 18 10

%e ...

%p a := (n, k) -> (n+1-k)*k-(n-1-k)*(k-2)*(limit(Heaviside(min(n+1-k, k)-3+x), x = 0, right)): seq(seq(a(n, k), k = 1 .. n), n = 1 .. 20)

%t Flatten[Table[(n + 1 - k) k-(n-1-k)*(k-2)Limit[HeavisideTheta[Min[n+1-k,k]-3+x], x->0, Direction->"FromAbove" ],{n, 20}, {k, n}]] (* or *)

%t f[n_] := Table[SeriesCoefficient[(x y - x^3 y^3)/((-1 + x)^2 (-1 + y)^2), {x, 0, i + 1 - j}, {y, 0, j}], {i, n, n}, {j, 1, n}]; Flatten[Array[f,20]]

%o (Magma)

%o [[k lt 3 or n+1-k lt 3 select (n+1-k)*k else 2*n-2: k in [1..n]]: n in [1..10]]; // triangle output

%o (PARI)

%o T(n, k) = if ((n+1-k<3) || (k<3), (n+1-k)*k, 2*n-2);

%o tabl(nn) = for(i=1, nn, for(j=1, i, print1(T(i, j), ", ")); print);

%o tabl(20) \\ triangle output

%Y Cf. A000027 (1st column/right diagonal of the triangle or 1st row/column of the table), A005843 (2nd row/column of the table, or 2nd column of the triangle), A008574 (main diagonal of the table), A005893 (row sum of the triangle).

%Y Cf. A003991 (the number of elements in an n X k matrix).

%Y Cf. A131821, A318274, A154325.

%K nonn,tabl

%O 1,2

%A _Stefano Spezia_, Sep 29 2018