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!)
 A134023 Number of zeros in balanced ternary representation of n. 8
 1, 0, 0, 1, 0, 0, 1, 0, 1, 2, 1, 0, 1, 0, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 3, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 3, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 4, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,10 REFERENCES D. E. Knuth, The Art of Computer Programming, Addison-Wesley, Reading, MA, Vol 2, pp 173-175. LINKS Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 Wikipedia, Balanced Ternary FORMULA a(n) = A134021(n) - A134022(n) - A134024(n). a(n) = A134021(n) - A005812(n). EXAMPLE 100=1*3^4+1*3^3-1*3^2+0*3^1+1*3^0=='++-0+': a(100)=1; 200=1*3^5-1*3^4+1*3^3+1*3^2+1*3^1-1*3^0=='+-+++-': a(200)=0; 300=1*3^5+1*3^4-1*3^3+0*3^2+1*3^1+0*3^0=='++-0+0': a(300)=2. MATHEMATICA Array[Count[If[First@ # == 0, Rest@ #, #], 0] &[Prepend[IntegerDigits[#, 3], 0] //. {a___, b_, 2, c___} :> {a, b + 1, -1, c}] &, 105, 0] (* Michael De Vlieger, Jun 27 2020 *) PROG (Python) def a(n):     if n==0: return 1     s=0     x=0     while n>0:         x=n%3         n=n//3         if x==2:             x=-1             n+=1         if x==0: s+=1     return s print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017 CROSSREFS Cf. A005812, A059095, A134021, A134022, A134024. Sequence in context: A219180 A179952 A321930 * A257931 A325699 A293513 Adjacent sequences:  A134020 A134021 A134022 * A134024 A134025 A134026 KEYWORD nonn,base AUTHOR Reinhard Zumkeller, Oct 19 2007 STATUS approved

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 August 3 10:43 EDT 2021. Contains 346435 sequences. (Running on oeis4.)