%I #16 Dec 11 2020 06:11:34
%S 1,1,1,1,1,1,8,29,106,491,2449,12860,72488,435241,2763053,18485280,
%T 129916333,956237591,7351602714,58897588844,490680801682,
%U 4242904633903,38014082900386,352341757997443,3373662297796822,33326335447469262,339232538360853201
%N Number of set partitions of [n] such that no part contains two elements with a circular distance less than three.
%C The circular distance of 1 and n is 1 (for n>1).
%H Alois P. Heinz, <a href="/A261478/b261478.txt">Table of n, a(n) for n = 0..100</a>
%e a(0) = 1: {}.
%e a(1) = 1: 1.
%e a(2) = 1: 1|2.
%e a(3) = 1: 1|2|3.
%e a(4) = 1: 1|2|3|4.
%e a(5) = 1: 1|2|3|4|5.
%e a(6) = 8: 14|25|36, 14|25|3|6, 14|2|36|5, 14|2|3|5|6, 1|25|36|4, 1|25|3|4|6, 1|2|36|4|5, 1|2|3|4|5|6.
%e a(7) = 29: 14|25|36|7, 14|25|37|6, 14|25|3|6|7, 14|26|37|5, 14|26|3|5|7, 14|2|36|5|7, 14|2|37|5|6, 14|2|3|5|6|7, 15|26|37|4, 15|26|3|47, 15|26|3|4|7, 15|2|36|47, 15|2|36|4|7, 15|2|37|4|6, 15|2|3|47|6, 15|2|3|4|6|7, 1|25|36|47, 1|25|36|4|7, 1|25|37|4|6, 1|25|3|47|6, 1|25|3|4|6|7, 1|26|37|4|5, 1|26|3|47|5, 1|26|3|4|5|7, 1|2|36|47|5, 1|2|36|4|5|7, 1|2|37|4|5|6, 1|2|3|47|5|6, 1|2|3|4|5|6|7.
%p b:= proc(n, l, m, h) option remember;
%p `if`(n=0, `if`(1 in [l, m] or l=2, 0, 1), add(
%p `if`(j in [l, m], 0, b(n-1, j, l, max(h, j))), j=1..h+1))
%p end:
%p a:= n-> `if`(n<6, 1, b(n, 0$3)):
%p seq(a(n), n=0..30);
%t b[n_, l_, m_, h_] := b[n, l, m, h] = If[n==0, If[l==1 || m==1 || l==2, 0, 1], Sum[If[j==l || j==m, 0, b[n - 1, j, l, Max[h, j]]], {j, 1, h + 1}]];
%t a[n_] := If[n < 6, 1, b[n, 0, 0, 0]];
%t a /@ Range[0, 30] (* _Jean-François Alcover_, Dec 11 2020, after _Alois P. Heinz_ *)
%Y Row sums of A261477.
%K nonn
%O 0,7
%A _Alois P. Heinz_, Aug 20 2015