%I M0021 #42 Jul 15 2024 05:33:27
%S 1,2,0,2,1,0,0,0,0,2,1,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,2,0,0,
%T 0,0,1,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,2,0,0,0,0,1,2,0,2,1,0,0,0,0,0,0,0,0,0,0
%N a(n) = C(2n,n) mod 3.
%C Removing 0's from the sequence gives Thue-Morse sequence A001285 : 1,2,0,2,1,0,0,0,0,2,1,0,1,2,..->1,2,2,1,2,1,1,2,... - _Benoit Cloitre_, Jan 04 2004
%C a(n) = 0 if n in A074940, a(n) = 1 if n in A074939, a(n) = 2 if n in A074938.
%C Central terms of the triangle in A083093. - _Reinhard Zumkeller_, Jul 11 2013
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Reinhard Zumkeller, <a href="/A006996/b006996.txt">Table of n, a(n) for n = 0..2187=3^7</a>
%H Michael Gilleland, <a href="/selfsimilar.html">Some Self-Similar Integer Sequences</a>
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F a(n) = A000984(n) mod 3.
%F a(n)=A005704(n) mod 3. - _Benoit Cloitre_, Jan 04 2004
%F A fixed point of the morphism : 1 -> 120, 2 -> 210, 0 -> 000. - _Philippe Deléham_, Jan 08 2004
%t Table[ Mod[ Binomial[2n, n], 3], {n, 0, 104}] (* Or *)
%t Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 0, 0}, 1 -> {1, 2, 0}, 2 -> {2, 1, 0}})]}], {1}, 7] (* _Robert G. Wilson v_, Mar 28 2005 *)
%o (Haskell)
%o a006996 n = a083093 (2 * n) n -- _Reinhard Zumkeller_, Jul 11 2013
%o (PARI) a(n)=if(n==0, return(1)); if(vecmax(Set(digits(n,3)))>1, 0, 1 + n%2) \\ _Charles R Greathouse IV_, May 09 2016
%K nonn,easy
%O 0,2
%A _N. J. A. Sloane_, _James Propp_