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”).

A228154
T(n,k) is the number of s in {1,...,n}^n having longest contiguous subsequence with the same value of length k; triangle T(n,k), n>=1, 1<=k<=n, read by rows.
4
1, 2, 2, 12, 12, 3, 108, 120, 24, 4, 1280, 1520, 280, 40, 5, 18750, 23400, 3930, 510, 60, 6, 326592, 423360, 65016, 7644, 840, 84, 7, 6588344, 8800008, 1241464, 132552, 13440, 1288, 112, 8, 150994944, 206622720, 26911296, 2622528, 244944, 22032, 1872, 144, 9
OFFSET
1,2
LINKS
FORMULA
Sum_{k=1..n} k * T(n,k) = A228194(n). - Alois P. Heinz, Dec 23 2020
EXAMPLE
T(1,1) = 1: [1].
T(2,1) = 2: [1,2], [2,1].
T(2,2) = 2: [1,1], [2,2].
T(3,1) = 12: [1,2,1], [1,2,3], [1,3,1], [1,3,2], [2,1,2], [2,1,3], [2,3,1], [2,3,2], [3,1,2], [3,1,3], [3,2,1], [3,2,3].
T(3,2) = 12: [1,1,2], [1,1,3], [1,2,2], [1,3,3], [2,1,1], [2,2,1], [2,2,3], [2,3,3], [3,1,1], [3,2,2], [3,3,1], [3,3,2].
T(3,3) = 3: [1,1,1], [2,2,2], [3,3,3].
Triangle T(n,k) begins:
. 1;
. 2, 2;
. 12, 12, 3;
. 108, 120, 24, 4;
. 1280, 1520, 280, 40, 5;
. 18750, 23400, 3930, 510, 60, 6;
. 326592, 423360, 65016, 7644, 840, 84, 7;
. 6588344, 8800008, 1241464, 132552, 13440, 1288, 112, 8;
MAPLE
T:= proc(n) option remember; local b; b:=
proc(m, s, i) option remember; `if`(m>i or s>m, 0,
`if`(i=1, n, `if`(s=1, (n-1)*add(b(m, h, i-1), h=1..m),
b(m, s-1, i-1) +`if`(s=m, b(m-1, s-1, i-1), 0))))
end; forget(b);
seq(add(b(k, s, n), s=1..k), k=1..n)
end:
seq(T(n), n=1..12); # Alois P. Heinz, Aug 18 2013
MATHEMATICA
T[n_] := T[n] = Module[{b}, b[m_, s_, i_] := b[m, s, i] = If[m>i || s>m, 0, If[i == 1, n, If[s == 1, (n-1)*Sum[b[m, h, i-1], {h, 1, m}], b[m, s-1, i-1] + If[s == m, b[m-1, s-1, i-1], 0]]]]; Table[Sum[b[k, s, n], {s, 1, k}], {k, 1, n}]]; Table[ T[n], {n, 1, 12}] // Flatten (* Jean-François Alcover, Mar 06 2015, after Alois P. Heinz *)
CROSSREFS
Row sums give: A000312.
Column k=1 gives: A055897.
Main diagonal gives: A000027.
Lower diagonal gives: 2*A180291.
Sequence in context: A307659 A327874 A190295 * A275279 A109767 A339297
KEYWORD
nonn,tabl
AUTHOR
Walt Rorie-Baety, Aug 15 2013
STATUS
approved