%I #22 Apr 17 2021 01:45:56
%S 1,4,16,60,228,864,3264,12336,46632,176208,665892,2516412,9509364,
%T 35935476,135798588,513176076,1939267560,7328398344
%N Number of quaternary cubefree words of length n.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CubefreeWord.html">Cubefree Word.</a>
%e a(3) counts the 64 three-letter words minus 000, 111, 222, and 333.
%o (Python)
%o from itertools import product
%o def cf(s):
%o for l in range(1, len(s)//3+1):
%o for i in range(len(s) - 3*l+1):
%o if s[i:i+l]*2 == s[i+l:i+3*l]: return False
%o return True
%o def a(n):
%o if n == 0: return 1
%o return 4*sum(cf("0"+"".join(w)) for w in product("0123", repeat=n-1))
%o print([a(n) for n in range(1, 12)]) # _Michael S. Branicky_, Apr 16 2021
%Y Cf. A028445, A051042.
%K nonn,more
%O 0,2
%A _Eric W. Weisstein_
%E More terms from _Sascha Kurz_, Mar 22 2002
%E a(0) prepended and a(16)-a(17) from _Michael S. Branicky_, Apr 16 2021