login
Number of compositions of {1,..,n} such that no two adjacent parts are of equal size (labeled Carlitz compositions), allowing parts to be of size 0.
2

%I #11 Sep 21 2019 03:59:24

%S 2,4,12,76,572,5204,59340,782996,11707324,197988340,3720933092,

%T 76811352116,1730660689580,42251140165108,1110607948991028,

%U 31279537587370916,939737174809843644,29996522608581396788,1013814287146517455812,36168456215193554061044

%N Number of compositions of {1,..,n} such that no two adjacent parts are of equal size (labeled Carlitz compositions), allowing parts to be of size 0.

%H Alois P. Heinz, <a href="/A114903/b114903.txt">Table of n, a(n) for n = 0..400</a>

%F E.g.f.: 2*B(x)/(2-B(x)) where B(x) is e.g.f. of A114902.

%F a(n) ~ c * d^n * n^(n + 1/2), where d = 0.6907524084725166379194613015033714490019226066943600905783847741049876032..., c = 4.71633079866926561049991146534865892961540468329142429184529629611133729... - _Vaclav Kotesovec_, Sep 21 2019

%p b:= proc(n, i) option remember;

%p `if`(n=0, `if`(i=0, 1, 2), add(`if`(i=j, 0, b(n-j,

%p `if`(j>n-j, -1, j))*binomial(n, j)), j=0..n))

%p end:

%p a:= n-> b(n, -1):

%p seq(a(n), n=0..25); # _Alois P. Heinz_, Sep 04 2015

%t b[n_, i_] := b[n, i] = If[n == 0, If[i == 0, 1, 2], Sum[If[i == j, 0, b[n - j, If[j > n - j, -1, j]]*Binomial[n, j]], {j, 0, n}]]; a[n_] := b[n, -1]; Table[a[n], {n, 0, 25}] (* _Jean-François Alcover_, Feb 25 2017, after _Alois P. Heinz_ *)

%Y Cf. A114900, A114902.

%K nonn

%O 0,1

%A _Christian G. Bower_, Jan 05 2006