OFFSET
0,4
COMMENTS
No two adjacent parts of a Carlitz composition are equal.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2000
FORMULA
a(n) = Sum_{k=0..floor(n/3)} (k+1) * A241701(n,k) for n>0, a(0) = 0.
EXAMPLE
a(1) = 1: (1).
a(2) = 1: (2).
a(3) = 4: (12), (2)(1), (3).
a(4) = 6: (12)(1), (13), (3)(1), (4).
a(5) = 11: (2)(12), (13)(1), (23), (3)(2), (14), (4)(1), (5).
MAPLE
b:= proc(n, l) option remember; `if`(n=0, [1, 0], add(`if`(j=l, 0,
(p-> p+`if`(j>l, [0, p[1]], 0))(b(n-j, j))), j=1..n))
end:
a:= n-> b(n, 0)[2]:
seq(a(n), n=0..40);
MATHEMATICA
b[n_, l_] := b[n, l] = If[n == 0, {1, 0}, Sum[If[j == l, {0, 0}, Function[p, p + If[j > l, {0, p[[1]]}, 0]][b[n - j, j]]], {j, 1, n}]];
a[n_] := b[n, 0][[2]];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Mar 05 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 30 2017
STATUS
approved