The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A060236 If n mod 3 = 0 then a(n) = a(n/3), otherwise a(n) = n mod 3. 10

%I

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

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

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

%N If n mod 3 = 0 then a(n) = a(n/3), otherwise a(n) = n mod 3.

%C A cubefree word. Start with 1, apply the morphisms 1 -> 121, 2 -> 122, take limit. See A080846 for another version.

%C Ultimate modulo 3: n-th digit of terms in "Ana sequence" (see A060032 for definition).

%C Equals A005148(n) reduced mod 3. In "On a sequence Arising in Series for Pi" Morris Newman and Daniel Shanks conjectured that 3 never divides A005148(n) and D. Zagier proved it. - _Benoit Cloitre_, Jun 22 2002

%C Also equals A038502(n) mod 3.

%C Last nonzero digit in ternary representation of n. - _Franklin T. Adams-Watters_, Apr 01 2006

%C a(2*n) = length of n-th run of twos. - _Reinhard Zumkeller_, Mar 13 2015

%H Reinhard Zumkeller, <a href="/A060236/b060236.txt">Table of n, a(n) for n = 1..1000</a>

%H Jean Berstel and J. Karhumaki, <a href="http://www-igm.univ-mlv.fr/~berstel/Articles/2003TutorialCoWdec03.pdf">Combinatorics on words - a tutorial</a>, Bull. EATCS, #79 (2003), pp. 178-228.

%H <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>

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

%F a(3*n) = a(n), a(3*n + 1) = 1, a(3*n + 2) = 2. - _Michael Somos_, Jul 29 2009

%F a(n) = 1 + A080846(n). - _Joerg Arndt_, Jan 21 2013

%F nts of mappings</a>

%e a(10)=1 since 10=3^0*10 and 10 mod 3=1;

%e a(72)=2 since 24=3^3*8 and 8 mod 3=2.

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

%t lnzd[m_]:=Module[{s=Split[m]},If[FreeQ[Last[s],0],s[[-1,1]],s[[-2,1]]]]; lnzd/@Table[IntegerDigits[n,3],{n,120}] (* _Harvey P. Dale_, Oct 19 2018 *)

%o (PARI) a(n)=if(n<1, 0, n/3^valuation(n,3)%3) /* _Michael Somos_, Nov 10 2005 */

%o a060236 = head . dropWhile (== 0) . a030341_row

%o -- _Reinhard Zumkeller_, Mar 13 2015

%o Table[Mod[n/3^IntegerExponent[n, 3], 3], {n, 1, 120}] (* _Clark Kimberling_, Oct 19 2016 *)

%Y Cf. A026140 and A026225 for sequence of n's for which a(n)=1, A026179 for sequence of n's for which a(n)=2. k-th term of A060032 is concatenation of first 3^k terms of a(n).

%Y Cf. A030341, A007089.

%K easy,nonn

%O 1,2

%A _Henry Bottomley_, Mar 21 2001

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 10 10:39 EDT 2021. Contains 342845 sequences. (Running on oeis4.)