login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of compositions of n, where the difference between the number of odd parts and the number of even parts is 1.
2

%I #14 Dec 28 2020 04:23:54

%S 1,0,1,3,1,9,11,18,51,65,151,290,477,1043,1835,3486,6931,12540,24607,

%T 46797,87979,171072,323269,619245,1190619,2264925,4357211,8343322,

%U 15973309,30711853,58846191,113027716,217192103,416964202,801880039,1541412015,2963997227

%N Number of compositions of n, where the difference between the number of odd parts and the number of even parts is 1.

%C With offset 2 number of compositions of n, where the difference between the number of odd parts and the number of even parts is -1.

%H Alois P. Heinz, <a href="/A242499/b242499.txt">Table of n, a(n) for n = 1..1000</a>

%F Recurrence (for n>=5): (n+2)*(16*n^4 - 128*n^3 + 344*n^2 - 352*n + 89)*a(n) = -32*(n+1)*(2*n-5)*a(n-1) + 2*(16*n^5 - 112*n^4 + 264*n^3 - 320*n^2 + 301*n - 89)*a(n-2) + 2*(2*n-5)*(16*n^4 - 80*n^3 + 80*n^2 + 36*n - 53)*a(n-3) - (n-4)*(16*n^4 - 64*n^3 + 56*n^2 + 16*n - 31)*a(n-4). - _Vaclav Kotesovec_, May 20 2014

%p a:= proc(n) option remember;

%p `if`(n<6, [0, 1, 0, 1, 3, 1][n+1],

%p ((3*n-2)*a(n-2) +(4*n+2)*a(n-3) -(3*n-10)*a(n-4)

%p -(4*n-22)*a(n-5) +(n-6)*a(n-6))/(n+2))

%p end:

%p seq(a(n), n=1..50);

%t a[n_] := a[n] = If[n<6, {0, 1, 0, 1, 3, 1}[[n+1]], ((3n-2)a[n-2] + (4n+2)a[n-3] - (3n-10)a[n-4] - (4n-22)a[n-5] + (n-6)a[n-6])/(n+2)];

%t Array[a, 50] (* _Jean-François Alcover_, Dec 28 2020, after _Alois P. Heinz_ *)

%Y Column k=1 of A242498.

%K nonn

%O 1,4

%A _Alois P. Heinz_, May 16 2014