A238159 Number of compositions of n with exactly one part equal to 1 or exactly one part equal to 2.
0, 1, 1, 2, 5, 11, 15, 35, 70, 124, 234, 447, 827, 1529, 2834, 5222, 9587, 17573, 32137, 58641, 106821, 194280, 352824, 639913, 1159238, 2097759, 3792375, 6849778, 12361822, 22292405, 40172089, 72344671, 130203409, 234200988, 421037335, 756538955, 1358728300
Offset: 0
Keywords
Examples
a(4) = 5 because we have: 1+3, 3+1, 1+1+2, 1+2+1, 2+1+1.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (9,-34,73,-109,137,-147,120,-79,40,3,-20,21,-22,8,-3,1,3,0,1).
Crossrefs
Programs
-
Mathematica
nn=30;a=1/(1-(x/(1-x)-x));b=1/(1-(x/(1-x)-x^2));c=1/(1-(x/(1-x)-x-x^2));CoefficientList[Series[a^2x +b^2x^2-2 c^3x^3,{x,0,nn}],x] (* or *) Table[Length[Select[Level[Table[Select[Compositions[n,k],Count[#,0]==0&],{k,1,n}],{2}],Count[#,1]==1||Count[#,2]==1&]],{n,0,10}]
Formula
G.f.: x*A(x)^2 + x^2*B(x)^2 - 2*x^3*C(x)^3 where A(x)=1/(1 - (x/(1-x)-x)), B(x)=1/(1 - (x/(1-x)-x^2)), C(x)=1/(1 - (x/(1-x)-x-x^2)).
a(n) ~ c * n / (2^(n-1) * d^n), where c = 0.02749202171174083217... is the root of the equation -1 + 18*c + 552*c^2 + 4232*c^3 = 0 and d = 0.2849201454990266329... is the root of the equation -1 + 4*d - 4*d^2 + 8*d^3 = 0. - Vaclav Kotesovec, May 01 2014