A095343 Length of n-th string generated by a Kolakoski(7,1) rule starting with a(1)=1.
1, 1, 7, 7, 31, 49, 145, 289, 727, 1591, 3775, 8545, 19873, 45505, 105127, 241639, 557023, 1281937, 2953009, 6798817, 15657847, 36054295, 83027839, 191190721, 440274241, 1013846401, 2334669127, 5376208327, 12380215711, 28508840689
Offset: 1
Keywords
Links
- G. C. Greubel, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (0, 4, 3).
Programs
-
GAP
a:=[1,1];; for n in [3..35] do a[n]:=a[n-1]-3*a[n-2]-3*(-1)^n; od; a; # G. C. Greubel, Dec 26 2019
-
Magma
I:=[1,1]; [n le 2 select I[n] else Self(n-1) + 3*Self(n-2) - 3*(-1)^n: n in [1..35]]; // G. C. Greubel, Dec 26 2019
-
Maple
seq(coeff(series(x*(1+x+3*x^2)/((1+x)*(1-x-3*x^2)), x, n+1), x, n), n = 0..35); # G. C. Greubel, Dec 26 2019
-
Mathematica
Table[ 3*(-1)^n + 2*Sqrt[3]^n*(Sqrt[3]*Fibonacci[n, 1/Sqrt[3]] - Fibonacci[n+1, 1/Sqrt[3]]), {n,35}]//FullSimplify (* G. C. Greubel, Dec 26 2019 *)
-
PARI
vector(35, n, round(3*(-1)^n + 2*(sqrt(3)/I)^n*(sqrt(3)*I* polchebyshev(n-1, 2, I/(2*sqrt(3))) - polchebyshev(n, 2, I/(2*sqrt(3)))) )) \\ G. C. Greubel, Dec 26 2019
-
Sage
def A095343_list(prec): P.
= PowerSeriesRing(ZZ, prec) return P( x*(1+x+3*x^2)/((1+x)*(1-x-3*x^2)) ).list() a=A095343_list(35); a[1:] # G. C. Greubel, Dec 26 2019
Formula
a(1) = a(2) = 1, a(n) = a(n-1) + 3*a(n-2) - 3*(-1)^n.
G.f.: x*(1+x+3*x^2)/((1+x)*(1-x-3*x^2)). - Colin Barker, Jul 02 2012
a(n) = 3*(-1)^n + 2*(sqrt(3)/i)^n*(sqrt(3)*i*ChebyshevU(n, i/(2*sqrt(3))) - ChebyshevU(n-1, i/(2*sqrt(3)))). - G. C. Greubel, Dec 26 2019
Comments