A106357 Number of compositions of n with exactly 1 adjacent equal pair of parts.
1, 0, 3, 6, 7, 20, 42, 72, 141, 280, 516, 976, 1853, 3420, 6361, 11844, 21819, 40192, 73942, 135452, 247828, 452776, 825252, 1501998, 2730159, 4954890, 8981360, 16261568, 29408708, 53130154, 95894384, 172917788, 311538169, 560831286
Offset: 2
Keywords
Links
- Alois P. Heinz, Table of n, a(n) for n = 2..1000
- A. Knopfmacher and H. Prodinger, On Carlitz compositions, European Journal of Combinatorics, Vol. 19, 1998, pp. 579-589.
Programs
-
Maple
b:= proc(n, v) option remember; `if`(n=0, [1, 0], add((p-> `if`(i=v, [0, p[1]], p))(b(n-i, i)), i=1..n)) end: a:= n-> b(n, 0)[2]: seq(a(n), n=2..45); # Alois P. Heinz, May 09 2014
-
Mathematica
b[n_, v_] := b[n, v] = If[n == 0, {1, 0}, Sum[Function[p, If[i == v, {0, p[[1]]}, p]][b[n - i, i]], {i, 1, n}]]; a[n_] := b[n, 0][[2]]; a /@ Range[2, 45] (* Jean-François Alcover, Nov 02 2020, after Alois P. Heinz *)
-
PARI
C_x(N)={my(g=1/(1 - sum(k=1, N, x^k/(1+x^k))));g} A_x(N)={my(x='x+O('x^N), h=sum(i=1,N,(C_x(N)*x^(2*i))/(1+x^i)^2 )/(1-sum(i=1,N,(x^i)/(1+x^i)))); Vec(h)} A_x(40) \\ John Tyler Rascoe, May 16 2024
Formula
a(n) ~ c * d^n * n, where d = A241902 = 1.750241291718309031249738624639..., c = 0.04826600476992825168367... . - Vaclav Kotesovec, Sep 05 2014
G.f.: (Sum_{i>0} C(x)*x^(2*i)/(1+x^i)^2)/(1 - Sum_{i>0} x^i/(1+x^i)) where C(x) is the g.f. for A003242. - John Tyler Rascoe, May 16 2024
Extensions
Replaced broken link, Vaclav Kotesovec, May 01 2014