%I #29 Apr 21 2023 13:00:35
%S 1,3,9,27,36,72,132,240,444,816,1500,2760,5076,9336,17172,31584,58092,
%T 106848,196524,361464,664836,1222824,2249124,4136784,7608732,13994640,
%U 25740156,47343528,87078324,160162008,294583860,541824192,996570060,1832978112
%N Number of ternary words of length n in which all digits 0..2 occur in every subword of 4 consecutive digits.
%C For n < 4 the constraint is voidly satisfied: each of the n-digit words satisfies the definition since there is no subword of length 4. - _M. F. Hasler_, Jan 13 2015
%H Colin Barker, <a href="/A248959/b248959.txt">Table of n, a(n) for n = 0..1000</a> (corrected by _Georg Fischer_, Jan 20 2019)
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,1).
%F G.f.: (1 + 2*x + 5*x^2 + 14*x^3 - 3*x^4 - 3*x^6)/(1 - x - x^2 - x^3). - Corrected by _Colin Barker_, Jan 12 2015
%F a(n) = a(n-1) + a(n-2) + a(n-3).
%F a(n) = A001590(n+1) * 12, for n>=4.
%F a(n) = A196700(n) * 6, for n>=4. - _Alois P. Heinz_, Jan 12 2015
%t Join[{1,3,9,27},LinearRecurrence[{1,1,1},{36,72,132},30]] (* _Harvey P. Dale_, Mar 12 2015 *)
%o (PARI) Vec((1+2*x+5*x^2+14*x^3-3*x^4-3*x^6)/(1-x-x^2-x^3) + O(x^100)) \\ _Colin Barker_, Jan 12 2015; extended to indices 0..3 by _M. F. Hasler_, Jan 13 2015
%Y Cf. A001590, A196700.
%K nonn,easy
%O 0,2
%A _Andrew Woods_, Jan 12 2015
%E a(0)-a(3) from _M. F. Hasler_, Jan 13 2015