A368579 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.
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, 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, 0, 0, 21, 37, 27, 15, 8, 4, 2, 1, 0, 1
Offset: 0
Examples
Triangle T(n, k) starts: [0] [ 1] [1] [-1, 1] [2] [ 0, 0, 1] [3] [ 0, 0, 0, 1] [4] [ 0, 0, 1, 0, 1] [5] [ 0, 0, 1, 1, 0, 1] [6] [ 0, 0, 2, 2, 1, 0, 1] [7] [ 0, 0, 3, 3, 2, 1, 0, 1] [8] [ 0, 0, 5, 6, 4, 2, 1, 0, 1] [9] [ 0, 0, 8, 11, 7, 4, 2, 1, 0, 1] For instance, row 6 lists the compositions below: 0 . 1 . 2 [2, 2, 2], [2, 1, 1, 2]; 3 [3, 3], [3, 1, 2]; 4 [4, 2]; 5 . 6 [6].
Crossrefs
Programs
-
Python
from functools import cache @cache def F(k, n): return sum(F(k, n-j) for j in range(1, min(k, n))) if n > 1 else n def Trow(n): return list(F(k+1, n+1-k) - F(k+1, n-k) for k in range(n+1)) print(flatten([Trow(n) for n in range(12)]))
Formula
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.