login
Number of compositions (ordered partitions) of n such that some part is repeated consecutively 4 times and no part is repeated consecutively more than 4 times.
2

%I #12 May 21 2018 04:13:27

%S 1,0,2,4,10,22,46,101,218,466,991,2093,4405,9232,19288,40169,83416,

%T 172806,357170,736710,1516714,3117133,6396116,13105012,26814264,

%U 54795330,111842771,228030558,464439943,945029466,1921169854,3902239742,7919743405,16061152291

%N Number of compositions (ordered partitions) of n such that some part is repeated consecutively 4 times and no part is repeated consecutively more than 4 times.

%H Alois P. Heinz, <a href="/A091618/b091618.txt">Table of n, a(n) for n = 4..1000</a>

%p b:= proc(n, l, k) option remember; `if`(n=0, 1, add(`if`(

%p i=l, 0, add(b(n-i*j, i, k), j=1..min(k, n/i))), i=1..n))

%p end:

%p a:= n-> b(n, 0, 4) -b(n, 0, 3):

%p seq(a(n), n=4..50); # _Alois P. Heinz_, Feb 08 2017

%t b[n_, l_, k_] := b[n, l, k] = If[n == 0, 1, Sum[If[i == l, 0, Sum[b[n - i*j, i, k], {j, 1, Min[k, n/i]}]], {i, 1, n}]];

%t a[n_] := b[n, 0, 4] - b[n, 0, 3];

%t Table[a[n], {n, 4, 50}] (* _Jean-François Alcover_, May 21 2018, after _Alois P. Heinz_ *)

%Y Column k=4 of A091613.

%K nonn

%O 4,3

%A _Christian G. Bower_, Jan 23 2004