login
Number of set partitions of [n] such that all absolute differences between least elements of consecutive blocks are <= two.
4

%I #14 May 28 2018 03:25:50

%S 1,1,2,5,14,44,152,571,2317,10096,47013,232944,1223428,6786936,

%T 39640947,243060305,1560340480,10461611439,73094563140,531127372268,

%U 4006242743228,31316162403165,253292622192153,2116823651781702,18255325000268015,162261535224570326

%N Number of set partitions of [n] such that all absolute differences between least elements of consecutive blocks are <= two.

%H Alois P. Heinz, <a href="/A287252/b287252.txt">Table of n, a(n) for n = 0..590</a>

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

%F a(n) = A287216(n,2).

%F a(n) = A000110(n) for n <= 3.

%p b:= proc(n, k, m, l) option remember; `if`(n<1, 1,

%p `if`(l-n>k, 0, b(n-1, k, m+1, n))+m*b(n-1, k, m, l))

%p end:

%p a:= n-> b(n-1, min(2, n-1), 1, n):

%p seq(a(n), n=0..30);

%t b[n_, k_, m_, l_] := b[n, k, m, l] = If[n < 1, 1, If[l - n > k, 0, b[n - 1, k, m + 1, n]] + m*b[n - 1, k, m, l]];

%t a[n_] := b[n - 1, Min[2, n - 1], 1, n];

%t Table[a[n], {n, 0, 30}] (* _Jean-François Alcover_, May 28 2018, from Maple *)

%Y Column k=2 of A287216.

%Y Cf. A000110.

%K nonn

%O 0,3

%A _Alois P. Heinz_, May 22 2017