cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A287416 Number T(n,k) of set partitions of [n] such that the maximal value of all absolute differences between least elements of consecutive blocks and between consecutive elements within the blocks equals k; triangle T(n,k), n>=0, 0<=k<=max(n-1,0), read by rows.

Original entry on oeis.org

1, 1, 0, 2, 0, 3, 2, 0, 4, 8, 3, 0, 5, 22, 19, 6, 0, 6, 52, 81, 48, 16, 0, 7, 114, 289, 267, 147, 53, 0, 8, 240, 941, 1250, 968, 529, 204, 0, 9, 494, 2894, 5310, 5469, 3919, 2174, 878, 0, 10, 1004, 8601, 21256, 28083, 25326, 17593, 9961, 4141
Offset: 0

Views

Author

Alois P. Heinz, May 24 2017

Keywords

Comments

The maximal value is assumed to be zero if there are no consecutive blocks and no consecutive elements.
T(n,k) is defined for all n,k >= 0. The triangle contains only the terms for k <= max(n-1,0). T(n,k) = 0 if k>=n and k>0.

Examples

			T(4,1) = 4: 1234, 1|234, 1|2|34, 1|2|3|4.
T(4,2) = 8: 124|3, 12|34, 12|3|4, 134|2, 13|24, 13|2|4, 1|23|4, 1|24|3.
T(4,3) = 3: 123|4, 14|23, 14|2|3.
T(5,3) = 19: 1235|4, 123|45, 123|4|5, 125|34, 125|3|4, 134|25, 134|2|5, 13|24|5, 13|25|4, 145|23, 14|235, 14|23|5, 1|234|5, 145|2|3, 14|25|3, 14|2|35, 14|2|3|5, 1|25|34, 1|25|3|4.
Triangle T(n,k) begins:
  1;
  1;
  0, 2;
  0, 3,   2;
  0, 4,   8,   3;
  0, 5,  22,  19,    6;
  0, 6,  52,  81,   48,  16;
  0, 7, 114, 289,  267, 147,  53;
  0, 8, 240, 941, 1250, 968, 529, 204;
  ...
		

Crossrefs

Columns k=1-2 give: A001477 (for n>1), A005803 (for n>0).
Row sums give A000110.

Programs

  • Maple
    b:= proc(n, k, l, t) option remember; `if`(n<1, 1, `if`(t-n>k, 0,
           b(n-1, k, map(x-> `if`(x-n>=k, [][], x), [l[], n]), n)) +add(
           b(n-1, k, sort(map(x-> `if`(x-n>=k, [][], x), subsop(j=n, l))),
           `if`(t-n>k, infinity, t)), j=1..nops(l)))
        end:
    A:= (n, k)-> b(n, min(k, n-1), [], n):
    T:= (n, k)-> A(n, k)-`if`(k=0, 0, A(n, k-1)):
    seq(seq(T(n, k), k=0..max(n-1, 0)), n=0..12);
  • Mathematica
    b[n_, k_, l_, t_] := b[n, k, l, t] = If[n < 1, 1, If[t - n > k, 0, b[n - 1, k, If[# - n >= k, Nothing, #]& /@ Append[l, n], n]] + Sum[b[n - 1, k, Sort[If[# - n >= k, Nothing, #]& /@ ReplacePart[l, j -> n]], If[t - n > k, Infinity, t]], {j, 1, Length[l]}]];
    A[n_, k_] := b[n, Min[k, n - 1], {}, n];
    T[n_, k_] := A[n, k] - If[k == 0, 0, A[n, k - 1]];
    Table[T[n, k], {n, 0, 12}, { k, 0, Max[n - 1, 0]}] // Flatten (* Jean-François Alcover, May 24 2018, translated from Maple *)

Formula

T(n,k) = A287417(n,k) - A287417(n,k-1) for k>0, T(n,0) = 1.
T(n+2,n+1) = 1 + A000110(n).