%I #20 Aug 06 2024 08:52:57
%S 2,2,0,1,0,2,1,1,2,2,0,1,1,2,0,1,2,2,0,1,0,2,1,1,0,2,2,1,1,2,0,1,2,2,
%T 0,1,0,2,1,1,2,2,0,1,1,2,0,1,0,2,2,1,0,2,1,1,0,2,2,1,1,2,0,1,2,2,0,1,
%U 0,2,1,1,2,2,0,1,1,2,0,1,2,2,0,1,0,2,1,1,0,2,2,1,1,2,0,1,0,2,2,1,0,2,1,1,2,2,0,1
%N Pagoda sequence: a(0) = b(n)-b(n-2) mod 3, where b(n) = A038189(n).
%H Fred Lunnon, <a href="http://web.archive.org/web/20080419052928id_/http://www.cs.may.ie/~fred/pagoda.ps">Pagodas and Sackcloth: Ternary Sequences of Considerable Linear Complexity</a>, Maynooth, July 1997. Also at <a href="https://citeseerx.ist.psu.edu/pdf/282abb0f652f8a73a0f5109e4ad7c24558eb1bf6">CiteSeerX</a>.
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F Repeated iteration of the inflation morphism A -> AB, B -> AD, C -> CB, D -> CD; giving ABADABCDABADCBCDABADABCDCBADCBCD ..., followed by the final morphism A -> 2201, B -> 0211, C -> 0221, D -> 1201 ., giving the Pagoda K_n mod 3 = 22010211 22011201 22010211 02211201 ...
%t Nest[ Flatten[ # /. {a -> {a, b}, b -> {a, d}, c -> {c, b}, d -> {c, d}}] &, {a}, 5] /. {a -> {2, 2, 0, 1}, b -> {0, 2, 1, 1}, c -> {0, 2, 2, 1}, d -> {1, 2, 0, 1}} // Flatten (* _Robert G. Wilson v_, Mar 04 2005 *)
%Y Cf. A038189.
%K nonn
%O -2,1
%A _Fred Lunnon_
%E More terms from _David W. Wilson_