%I #11 Jun 15 2026 22:34:26
%S 1,4,12,36,96,248,608,1504,3648,8608,19392,43712,98304,222208,498560,
%T 1118784,2511872,5607296,12138496,25944960,55059456
%N a(n) is the number of 4-ary sequences of length n with characteristic value 2.
%C A 4-ary sequence is a sequence in which every term is 0, 1, 2 or 3.
%C Define the difference sequence of a 4-ary sequence (x(1), ..., x(n)) as (|x(1) - x(2)|, |x(2) - x(3)|, ..., |x(n-1) - x(n)|). The difference operation is similar to the Ducci game, except that there is no |x(n) - x(1)| term.
%C For a 4-ary sequence S of length n, take its difference sequence n-1 times, and the remaining number is the characteristic value of S.
%H Yifan Xie, <a href="/A396614/a396614_1.py.txt">Python program</a>
%F a(n) = 2*4^(n-1) - A396251(n).
%F a(n) <= n^2 * 2^n.
%e For n = 2, the a(2) = 4 sequences are (0, 2), (1, 3), (2, 0) and (3, 1).
%Y Cf. A396250, A396251.
%K nonn,more
%O 1,2
%A _Yifan Xie_, May 31 2026
%E a(21) from _Sean A. Irvine_, Jun 15 2026