login
Triangle read by rows. T(n, k) is the number of compositions of n where the first part k is the largest part and the last part is not 1.
2

%I #18 Jan 05 2024 12:45:58

%S 1,-1,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,2,2,1,0,1,0,0,3,3,2,1,

%T 0,1,0,0,5,6,4,2,1,0,1,0,0,8,11,7,4,2,1,0,1,0,0,13,20,14,8,4,2,1,0,1,

%U 0,0,21,37,27,15,8,4,2,1,0,1

%N Triangle read by rows. T(n, k) is the number of compositions of n where the first part k is the largest part and the last part is not 1.

%F T(n, k) = F(k+1, n+1-k) - F(k+1, n-k) where F(k, n) = Sum_{j=1..min(n, k)} F(k, n-j) if n > 1 and otherwise n. F(n, k) refers to the generalized Fibonacci numbers A092921.

%e Triangle T(n, k) starts:

%e [0] [ 1]

%e [1] [-1, 1]

%e [2] [ 0, 0, 1]

%e [3] [ 0, 0, 0, 1]

%e [4] [ 0, 0, 1, 0, 1]

%e [5] [ 0, 0, 1, 1, 0, 1]

%e [6] [ 0, 0, 2, 2, 1, 0, 1]

%e [7] [ 0, 0, 3, 3, 2, 1, 0, 1]

%e [8] [ 0, 0, 5, 6, 4, 2, 1, 0, 1]

%e [9] [ 0, 0, 8, 11, 7, 4, 2, 1, 0, 1]

%e For instance, row 6 lists the compositions below:

%e 0 .

%e 1 .

%e 2 [2, 2, 2], [2, 1, 1, 2];

%e 3 [3, 3], [3, 1, 2];

%e 4 [4, 2];

%e 5 .

%e 6 [6].

%o (Python)

%o from functools import cache

%o @cache

%o def F(k, n):

%o return sum(F(k, n-j) for j in range(1, min(k, n))) if n > 1 else n

%o def Trow(n):

%o return list(F(k+1, n+1-k) - F(k+1, n-k) for k in range(n+1))

%o print(flatten([Trow(n) for n in range(12)]))

%Y Cf. A368279 (row sums), A092921 (generalized Fibonacci), A000045 (Fibonacci column k=2), A034008 (T(2n, n)).

%K sign,tabl

%O 0,24

%A _Peter Luschny_, Jan 05 2024