login
Number of elements in n-th string generated by a Kolakoski(5,1) rule starting with a(1)=1.
6

%I #21 Sep 08 2022 08:45:13

%S 1,1,5,5,17,25,61,109,233,449,917,1813,3649,7273,14573,29117,58265,

%T 116497,233029,466021,932081,1864121,3728285,7456525,14913097,

%U 29826145,59652341,119304629,238609313,477218569,954437197,1908874333,3817748729

%N Number of elements in n-th string generated by a Kolakoski(5,1) rule starting with a(1)=1.

%C Each string is derived from the previous string using the Kolakoski(5,1) rule and the additional condition: "string begins with 1 if previous string ends with 5 and vice versa". The strings are 1 -> 5 -> 11111 -> 51515 -> 11111511111511111 -> ... and each one contains 1,1,5,5,17,... elements.

%C Equals inverse binomial transform of A025579. - _Gary W. Adamson_, Mar 04 2010

%H G. C. Greubel, <a href="/A095342/b095342.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,3,2).

%F a(1) = a(2) = 1, a(n) = a(n-1) + 2*a(n-2) - 2*(-1)^n.

%F From _R. J. Mathar_, Apr 01 2010: (Start)

%F G.f.: x*(1+x+2*x^2)/((1-2*x)*(1+x)^2).

%F a(n) = (2^(n+2) + (-1)^n*(5-6*n))/9. (End)

%F E.g.f.: (exp(2*x) - 9 + (5+6*x)*exp(-x))/9. - _G. C. Greubel_, Dec 26 2019

%p seq( (2^(n+2) + (-1)^n*(5-6*n))/9, n=1..35); # _G. C. Greubel_, Dec 26 2019

%t Table[(2^(n+2) + (-1)^n*(5-6*n))/9, {n,35}] (* _G. C. Greubel_, Dec 26 2019 *)

%o (PARI) vector(35, n, (2^(n+2) + (-1)^n*(5-6*n))/9) \\ _G. C. Greubel_, Dec 26 2019

%o (Magma) [(2^(n+2) + (-1)^n*(5-6*n))/9: n in [1..35]]; // _G. C. Greubel_, Dec 26 2019

%o (Sage) [(2^(n+2) + (-1)^n*(5-6*n))/9 for n in (1..35)] # _G. C. Greubel_, Dec 26 2019

%o (GAP) List([1..35], n-> (2^(n+2) + (-1)^n*(5-6*n))/9); # _G. C. Greubel_, Dec 26 2019

%Y Cf. A000002, A066983, A095343, A095344.

%Y Cf. A025579 . - _Gary W. Adamson_, Mar 04 2010

%K nonn

%O 1,3

%A _Benoit Cloitre_, Jun 03 2004