OFFSET
0,3
COMMENTS
For p=2, the sequence enumerates Carlitz compositions, A003242.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Sylvie Corteel and Paweł Hitczenko, Generalizations of Carlitz Compositions, Journal of Integer Sequences, Vol. 10 (2007), Article 07.8.8.
FORMULA
G.f.: 1/(1 - Sum_{k>0} (z^k/(1-z^k) - 3*z^(k*3)/(1-z^(k*3)))).
For general p the generating function is 1/(1 - Sum_{k>0}(z^k/(1-z^k) - p*z^(k*p)/(1-z^(k*p)))).
EXAMPLE
a(3)=4 because, for p=3, we can write:
3^{1},
1^{1} 2^{1},
2^{1} 1^{1},
1^{1} 1^{1} 1^{1}.
MAPLE
b:= proc(n, i, j) option remember;
`if`(n=0, 1, add(add(`if`(k=i and m+j=3, 0,
b(n-k*m, k, m)), m=1..min(2, n/k)), k=1..n))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..40); # Alois P. Heinz, Jul 22 2017
MATHEMATICA
b[n_, i_, j_] := b[n, i, j] = If[n == 0, 1, Sum[Sum[If[k == i && m + j == 3, 0, b[n - k m, k, m]], {m, 1, Min[2, n/k]}], {k, 1, n}]];
a[n_] := b[n, 0, 0];
a /@ Range[0, 40] (* Jean-François Alcover, Nov 10 2020, after Alois P. Heinz *)
PROG
(PARI) N = 66; x = 'x + O('x^N); p=3;
gf = 1/(1-sum(k=1, N, x^k/(1-x^k)-p*x^(k*p)/(1-x^(k*p))));
Vec(gf) /* Joerg Arndt, Apr 28 2013 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Pawel Hitczenko (phitczenko(AT)math.drexel.edu), Jun 05 2007
EXTENSIONS
Added more terms, Joerg Arndt, Apr 28 2013
STATUS
approved