login
Number T(n,k) of set partitions of [n] such that the maximal absolute difference between consecutive elements within a block equals k; triangle T(n,k), n>=0, 0<=k<=max(n-1,0), read by rows.
15

%I #37 Dec 27 2018 22:43:03

%S 1,1,1,1,1,3,1,1,7,5,2,1,15,18,13,5,1,31,57,61,38,15,1,63,169,248,215,

%T 129,52,1,127,482,935,1061,836,495,203,1,255,1341,3368,4835,4789,3573,

%U 2108,877,1,511,3669,11777,20973,25430,22986,16657,9831,4140

%N Number T(n,k) of set partitions of [n] such that the maximal absolute difference between consecutive elements within a block equals k; triangle T(n,k), n>=0, 0<=k<=max(n-1,0), read by rows.

%C The maximal absolute difference is assumed to be zero if there is no block with consecutive elements.

%C T(n,k) is defined for all n,k >= 0. The triangle contains only the positive terms. T(n,k) = 0 if k>=n and k>0.

%H Alois P. Heinz, <a href="/A287213/b287213.txt">Rows n = 0..23, flattened</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Partition_of_a_set">Partition of a set</a>

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

%e T(4,0) = 1: 1|2|3|4.

%e T(4,1) = 7: 1234, 123|4, 12|34, 12|3|4, 1|234, 1|23|4, 1|2|34.

%e T(4,2) = 5: 124|3, 134|2, 13|24, 13|2|4, 1|24|3.

%e T(4,3) = 2: 14|23, 14|2|3.

%e Triangle T(n,k) begins:

%e 1;

%e 1;

%e 1, 1;

%e 1, 3, 1;

%e 1, 7, 5, 2;

%e 1, 15, 18, 13, 5;

%e 1, 31, 57, 61, 38, 15;

%e 1, 63, 169, 248, 215, 129, 52;

%e 1, 127, 482, 935, 1061, 836, 495, 203;

%p b:= proc(n, k, l) option remember; `if`(n=0, 1, b(n-1, k, map(x->

%p `if`(x-n>=k, [][], x), [l[], n]))+add(b(n-1, k, sort(map(x->

%p `if`(x-n>=k, [][], x), subsop(j=n, l)))), j=1..nops(l)))

%p end:

%p A:= (n, k)-> b(n, min(k, n-1), []):

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

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

%t b[0, _, _] = 1; b[n_, k_, l_] := b[n, k, l] =b[n - 1, k, If[# - n >= k, Nothing, #]& /@ Append[l, n]] + Sum[b[n - 1, k, Sort[If[# - n >= k, Nothing, #]& /@ ReplacePart[l, j -> n]]], {j, 1, Length[l]}];

%t A[n_, k_] := b[n, Min[k, n - 1], {}];

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

%t Table[Table[T[n, k], {k, 0, Max[n - 1, 0]}], {n, 0, 12}] // Flatten (* _Jean-François Alcover_, Apr 30 2018, after _Alois P. Heinz_ *)

%Y Columns k=0-10 give: A000012, A000225(n-1), A258109, A294052, A294053, A294054, A294055, A294056, A294057, A294058, A294059.

%Y Row sums and T(n+2,n+1) give A000110.

%Y T(2n,n) gives A294024.

%Y Cf. A287214, A287215, A287416, A287640.

%K nonn,tabf

%O 0,6

%A _Alois P. Heinz_, May 21 2017