A249019 Number of ternary words of length n in which all digits 0..2 occur in every 6 consecutive digits.
1, 3, 9, 27, 81, 243, 540, 1440, 3804, 9960, 25908, 67344, 175884, 458832, 1196364, 3119304, 8134164, 21212832, 55316892, 144249168, 376159644, 980918904, 2557958964, 6670420704, 17394543180, 45359994336, 118285895244, 308455762488, 804364332180, 2097551985168, 5469815336796, 14263713072192
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,2,3,5,6,-1,-1,0,-1,-1).
Programs
-
Mathematica
LinearRecurrence[{1,2,3,5,6,-1,-1,0,-1,-1},{1,3,9,27,81,243,540,1440,3804,9960,25908,67344,175884,458832,1196364,3119304},40] (* Harvey P. Dale, Feb 05 2019 *)
-
PARI
Vec(-12*x^6*(20*x^9 +27*x^8 +9*x^7 +23*x^6 +28*x^5 -110*x^4 -138*x^3 -107*x^2 -75*x -45) / (x^10 +x^9 +x^7 +x^6 -6*x^5 -5*x^4 -3*x^3 -2*x^2 -x +1) + O(x^100)) \\ Colin Barker, Jan 12 2015
Formula
a(n) = a(n-1) + 2*a(n-2) + 3*a(n-3) + 5*a(n-4) + 6*a(n-5) - a(n-6) - a(n-7) - a(n-9) - a(n-10), for n>=16.
G.f.: (1 + 2*x + 4*x^2 + 9*x^3 + 22*x^4 + 60*x^5 - 8*x^6 - 14*x^7 - 8*x^9 - 26*x^10 + 3*x^12 + 3*x^15)/(1 - x - 2*x^2 - 3*x^3 - 5* x^4 - 6*x^5 + x^6 + x^7 + x^9 + x^10). - Colin Barker, Jan 12 2015