cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A060236 #49 Nov 05 2024 21:57:35
%S A060236 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 A060236 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 A060236 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 A060236 If n mod 3 = 0 then a(n) = a(n/3), otherwise a(n) = n mod 3.
%C A060236 A cubefree word. Start with 1, apply the morphisms 1 -> 121, 2 -> 122, take limit. See A080846 for another version.
%C A060236 Ultimate modulo 3: n-th digit of terms in "Ana sequence" (see A060032 for definition).
%C A060236 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 A060236 Also equals A038502(n) mod 3.
%C A060236 Last nonzero digit in ternary representation of n. - _Franklin T. Adams-Watters_, Apr 01 2006
%C A060236 a(2*n) = length of n-th run of twos. - _Reinhard Zumkeller_, Mar 13 2015
%H A060236 Reinhard Zumkeller, <a href="/A060236/b060236.txt">Table of n, a(n) for n = 1..1000</a>
%H A060236 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 A060236 <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>
%H A060236 <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F A060236 a(3*n) = a(n), a(3*n + 1) = 1, a(3*n + 2) = 2. - _Michael Somos_, Jul 29 2009
%F A060236 a(n) = 1 + A080846(n). - _Joerg Arndt_, Jan 21 2013
%e A060236 a(10)=1 since 10=3^0*10 and 10 mod 3=1;
%e A060236 a(72)=2 since 24=3^3*8 and 8 mod 3=2.
%t A060236 Nest[ Flatten[ # /. {1 -> {1, 2, 1}, 2 -> {1, 2, 2}}] &, {1}, 5] (* _Robert G. Wilson v_, Mar 04 2005 *)
%t A060236 Table[Mod[n/3^IntegerExponent[n, 3], 3], {n, 1, 120}] (* _Clark Kimberling_, Oct 19 2016 *)
%t A060236 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 A060236 (PARI) a(n)=if(n<1, 0, n/3^valuation(n,3)%3) /* _Michael Somos_, Nov 10 2005 */
%o A060236 (Haskell)  following _Franklin T. Adams-Watters_'s comment.
%o A060236 a060236 = head . dropWhile (== 0) . a030341_row
%o A060236 -- _Reinhard Zumkeller_, Mar 13 2015
%o A060236 (Magma) [(Floor(n/3^Valuation(n, 3)) mod 3): n in [1..120]]; // _G. C. Greubel_, Nov 05 2024
%o A060236 (SageMath) [n/3^valuation(n, 3)%3 for n in range(1,121)] # _G. C. Greubel_, Nov 05 2024
%Y A060236 Cf. A026225 (indices of 1's), A026179 (indices of 2's).
%Y A060236 Cf. A060032 (concatenate 3^n terms).
%Y A060236 Cf. A030341, A007089.
%K A060236 easy,nonn
%O A060236 1,2
%A A060236 _Henry Bottomley_, Mar 21 2001