OFFSET
0,5
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..721
Wikipedia, Partition of a set
EXAMPLE
a(5) = 3: 14|25|3, 1|25|3|4, 1|2|3|4|5.
a(6) = 4: 14|25|36, 1|25|36|4, 1|2|36|4|5, 1|2|3|4|5|6.
a(7) = 9: 147|25|36, 14|25|36|7, 17|25|36|4, 1|25|36|47, 17|2|36|4|5, 1|2|36|47|5, 17|2|3|4|5|6, 1|2|3|47|5|6, 1|2|3|4|5|6|7.
MAPLE
b:= proc(n, m, t) option remember; `if`(n=0, 1,
add(`if`(irem(j-t, 3)=0, b(n-1, max(m, j),
irem(t+1, 3)), 0), j=1..m+1))
end:
a:= n-> b(n, 0, 1):
seq(a(n), n=0..35);
MATHEMATICA
b[n_, m_, t_] := b[n, m, t] = If[n == 0, 1, Sum[If[Mod[j-t, 3] == 0, b[n-1, Max[m, j], Mod[t+1, 3]], 0], {j, 1, m+1}]];
a[n_] := b[n, 0, 1];
Table[a[n], {n, 0, 35}] (* Jean-François Alcover, May 15 2018, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 08 2016
STATUS
approved