%I #17 Oct 27 2016 11:46:57
%S 1,3,9,27,81,150,366,870,2022,4686,10974,25614,59742,139398,325350,
%T 759198,1771590,4134126,9647262,22512342,52533750,122590422,286071414,
%U 667563054,1557794622,3635198310,8482932318,19795382454,46193598486,107795266974,251546100558,586996465758,1369788083022
%N Number of ternary words of length n in which all digits 0..2 occur in every 5 consecutive digits.
%H Colin Barker, <a href="/A248960/b248960.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (1,2,2,2,-1,-1).
%F G.f.: (1+2*x+4*x^2+10*x^3+28*x^4-8*x^5-14*x^6-6*x^8+3*x^10) / ((1+x)*(1-2*x-2*x^3+x^5)). - _Colin Barker_, Oct 27 2016
%F a(n) = a(n-1) + 2*a(n-2) + 2*a(n-3) + 2*a(n-4) - a(n-5) - a(n-6).
%F a(n) = A242317(n-4) * 6.
%t Join[{1,3,9,27,81},LinearRecurrence[{1,2,2,2,-1,-1},{150,366,870,2022,4686,10974},30]] (* _Harvey P. Dale_, Apr 04 2015 *)
%o (PARI) Vec((1+2*x+4*x^2+10*x^3+28*x^4-8*x^5-14*x^6-6*x^8+3*x^10)/((1+x)*(1-2*x-2*x^3+x^5)) + O(x^30)) \\ _Colin Barker_, Oct 27 2016
%Y Cf. A242317, A249019.
%K nonn,easy
%O 0,2
%A _Andrew Woods_, Jan 12 2015
%E Changed offset to 0. - _N. J. A. Sloane_, Jan 15 2015