login
a(n) = (sum of digits of n written in base 3) modulo 3.
18

%I #60 Jul 04 2018 10:43:19

%S 0,1,2,1,2,0,2,0,1,1,2,0,2,0,1,0,1,2,2,0,1,0,1,2,1,2,0,1,2,0,2,0,1,0,

%T 1,2,2,0,1,0,1,2,1,2,0,0,1,2,1,2,0,2,0,1,2,0,1,0,1,2,1,2,0,0,1,2,1,2,

%U 0,2,0,1,1,2,0,2,0,1,0,1,2,1,2,0,2,0,1,0,1,2,2,0,1,0,1,2,1,2,0,0,1,2,1,2,0

%N a(n) = (sum of digits of n written in base 3) modulo 3.

%C Start with 0, repeatedly apply the morphism 0->012, 1->120, 2->201. This is a ternary version of the Thue-Morse sequence A010060. See Brlek (1989). - _N. J. A. Sloane_, Jul 10 2012

%C Equals A004128 mod 3. [_Gary W. Adamson_, Aug 24 2008]

%C A090193 is generated by the same mapping starting with 1. A090239 is generated by the same mapping starting with 2. - _Andrey Zabolotskiy_, May 04 2016.

%H Vincenzo Librandi, <a href="/A053838/b053838.txt">Table of n, a(n) for n = 0..2000</a>

%H S. Brlek, <a href="http://dx.doi.org/10.1016/0166-218X(92)90274-E">Enumeration of factors in the Thue-Morse word</a>, Discrete Applied Math. 24 (1989), 83-96.

%H Arthur Dolgopolov, <a href="https://arthurdolgopolov.net/papers/TM.pdf">Equitable Sequencing and Allocation Under Uncertainty</a>, Preprint, 2016.

%H Glen Joyce C. Dulatre, Jamilah V. Alarcon, Vhenedict M. Florida, Daisy Ann A. Disu, <a href="http://www.dmmmsu-sluc.com/wp-content/uploads/2018/03/CAS-Monitor-2016-2017-1.pdf">On Fractal Sequences</a>, DMMMSU-CAS Science Monitor (2016-2017) Vol. 15 No. 2, 109-113.

%H Michael Gilleland, <a href="/selfsimilar.html">Some Self-Similar Integer Sequences</a>

%H Michel Rigo, <a href="http://arxiv.org/abs/1602.03364">Relations on words</a>, arXiv preprint arXiv:1602.03364 [cs.FL], 2016. See Example 17.

%H Robert Walker, <a href="http://robertinventor.com/ftswiki/Self_Similar_Sloth_Canon_Number_Sequences">Self Similar Sloth Canon Number Sequences</a>

%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>

%F a(n) = A010872(A053735(n)) =(n+a(floor[n/3])) mod 3. So one can construct sequence by starting with 0 and mapping 0->012, 1->120 and 2->201 (e.g. 0, 012, 012120201, 012120201120201012201012120, ...) and looking at n-th digit of a term with sufficient digits.

%p A053838 := proc(n)

%p add(d,d=convert(n,base,3)) ;

%p modp(%,3) ;

%p end proc:

%p seq(A053838(n),n=0..100) ; # _R. J. Mathar_, Nov 04 2017

%t Nest[ Flatten[ # /. {0 -> {0, 1, 2}, 1 -> {1, 2, 0}, 2 -> {2, 0, 1}}] &, {0}, 7] (* _Robert G. Wilson v_, Mar 08 2005 *)

%o (PARI) a(n) = vecsum(digits(n, 3)) % 3; \\ _Michel Marcus_, May 04 2016

%Y Cf. A004128, A010060, A053837, A053839-A053844.

%Y Equals A026600(n+1) - 1.

%K base,nonn

%O 0,3

%A _Henry Bottomley_, Mar 28 2000