OFFSET
0,6
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..500
FORMULA
a(n) ~ A003242(n). - Vaclav Kotesovec, Sep 08 2015
EXAMPLE
a(4) = 1: 121.
a(5) = 2: 131, 212.
a(6) = 3: 141, 1212, 2121.
a(7) = 8: 151, 232, 313, 1213, 1312, 2131, 3121, 12121.
a(8) = 16: 161, 242, 323, 1214, 1232, 1313, 1412, 2123, 2141, 2321, 3131, 3212, 4121, 12131, 13121, 21212.
MAPLE
g:= proc(n, i) option remember; `if`(n=0, 1, add(
`if`(i=j, 0, g(n-j, j)), j=1..n))
end:
b:= proc(n, i, m) option remember; `if`(n=0, 0, add(
`if`(i=j, 0, `if`(j=m, g(n-j, j), b(n-j, j, i))), j=1..n))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..45);
MATHEMATICA
g[n_, i_] := g[n, i] = If[n==0, 1, Sum[If[i==j, 0, g[n-j, j]], {j, 1, n}]];
b[n_, i_, m_] := b[n, i, m] = If[n==0, 0, Sum[If[i==j, 0, If[j==m, g[n-j, j], b[n-j, j, i]]], {j, 1, n}]];
a[n_] := b[n, 0, 0];
a /@ Range[0, 45] (* Jean-François Alcover, Dec 21 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 07 2015
STATUS
approved