login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number T(n,k) of sets of nonempty words with a total of n letters over k-ary alphabet such that for k>0 the k-th letter occurs at least once and within each word every letter of the alphabet is at least as frequent as the subsequent alphabet letter; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
4

%I #22 Feb 09 2021 10:59:44

%S 1,0,1,0,1,2,0,2,5,6,0,2,16,18,24,0,3,39,80,84,120,0,4,106,323,432,

%T 480,720,0,5,245,1106,2052,2820,3240,5040,0,6,621,3822,10576,14820,

%U 21480,25200,40320,0,8,1431,13840,41896,86724,124440,186480,221760,362880

%N Number T(n,k) of sets of nonempty words with a total of n letters over k-ary alphabet such that for k>0 the k-th letter occurs at least once and within each word every letter of the alphabet is at least as frequent as the subsequent alphabet letter; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

%C T(n,k) is defined for n,k >= 0. The triangle contains only the terms with k <= n. T(n,k) = 0 for k > n.

%H Alois P. Heinz, <a href="/A319498/b319498.txt">Rows n = 0..140, flattened</a>

%F T(n,k) = A292795(n,k) - A292795(n,k-1) for k > 0, T(n,0) = A000007(n).

%e T(3,1) = 2: {aaa}, {aa,a}.

%e T(3,2) = 5: {aab}, {aba}, {baa}, {ab,a}, {ba,a}.

%e T(3,3) = 6: {abc}, {acb}, {bac}, {bca}, {cab}, {cba}.

%e Triangle T(n,k) begins:

%e 1;

%e 0, 1;

%e 0, 1, 2;

%e 0, 2, 5, 6;

%e 0, 2, 16, 18, 24;

%e 0, 3, 39, 80, 84, 120;

%e 0, 4, 106, 323, 432, 480, 720;

%e 0, 5, 245, 1106, 2052, 2820, 3240, 5040;

%e 0, 6, 621, 3822, 10576, 14820, 21480, 25200, 40320;

%e ...

%p b:= proc(n, i, t) option remember; `if`(t=1, 1/n!,

%p add(b(n-j, j, t-1)/j!, j=i..n/t))

%p end:

%p g:= (n, k)-> `if`(k=0, `if`(n=0, 1, 0), n!*b(n, 0, k)):

%p h:= proc(n, i, k) option remember; `if`(n=0, 1, `if`(i<1, 0,

%p add(h(n-i*j, i-1, k)*binomial(g(i, k), j), j=0..n/i)))

%p end:

%p T:= (n, k)-> h(n$2, k) -`if`(k=0, 0, h(n$2, k-1)):

%p seq(seq(T(n, k), k=0..n), n=0..12);

%t b[n_, i_, t_] := b[n, i, t] = If[t == 1, 1/n!,

%t Sum[b[n - j, j, t - 1]/j!, {j, i, n/t}]];

%t g[n_, k_] := If[k == 0, If[n == 0, 1, 0], n!*b[n, 0, k]];

%t h[n_, i_, k_] := h[n, i, k] = If[n == 0, 1, If[i < 1, 0,

%t Sum[h[n - i*j, i - 1, k]*Binomial[g[i, k], j], {j, 0, n/i}]]];

%t T[n_, k_] := h[n, n, k] - If[k == 0, 0, h[n, n, k - 1]];

%t Table[Table[T[n, k], {k, 0, n}], {n, 0, 12}] // Flatten (* _Jean-François Alcover_, Feb 09 2021, after _Alois P. Heinz_ *)

%Y Columns k=0-1 give: A000007, A000009 (for n>0).

%Y Row sums give A292796.

%Y Main diagonal gives A000142.

%Y First lower diagonal gives A038720 (for n>1).

%Y Cf. A292795, A319495.

%K nonn,tabl

%O 0,6

%A _Alois P. Heinz_, Sep 20 2018