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.

A287213 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.

Original entry on oeis.org

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, 129, 52, 1, 127, 482, 935, 1061, 836, 495, 203, 1, 255, 1341, 3368, 4835, 4789, 3573, 2108, 877, 1, 511, 3669, 11777, 20973, 25430, 22986, 16657, 9831, 4140
Offset: 0

Views

Author

Alois P. Heinz, May 21 2017

Keywords

Comments

The maximal absolute difference is assumed to be zero if there is no block with consecutive elements.
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.

Examples

			T(4,0) = 1: 1|2|3|4.
T(4,1) = 7: 1234, 123|4, 12|34, 12|3|4, 1|234, 1|23|4, 1|2|34.
T(4,2) = 5: 124|3, 134|2, 13|24, 13|2|4, 1|24|3.
T(4,3) = 2: 14|23, 14|2|3.
Triangle T(n,k) begins:
  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, 129,  52;
  1, 127, 482, 935, 1061, 836, 495, 203;
		

Crossrefs

Row sums and T(n+2,n+1) give A000110.
T(2n,n) gives A294024.

Programs

  • Maple
    b:= proc(n, k, l) option remember; `if`(n=0, 1, b(n-1, k, map(x->
          `if`(x-n>=k, [][], x), [l[], n]))+add(b(n-1, k, sort(map(x->
          `if`(x-n>=k, [][], x), subsop(j=n, l)))), j=1..nops(l)))
        end:
    A:= (n, k)-> b(n, min(k, n-1), []):
    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[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]}];
    A[n_, k_] := b[n, Min[k, n - 1], {}];
    T[n_, k_] :=  A[n, k] - If[k == 0, 0, A[n, k - 1]];
    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 *)

Formula

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