The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A062756 Number of 1's in ternary (base-3) expansion of n. 56
 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, 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 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,5 COMMENTS Fixed point of the morphism: 0 ->010; 1 ->121; 2 ->232; ...; n -> n(n+1)n, starting from a(0)=0. - Philippe Deléham, Oct 25 2011 LINKS Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 F. T. Adams-Watters and F. Ruskey, Generating Functions for the Digital Sum and Other Digit Counting Sequences, JIS 12 (2009) 09.5.6. Michael Gilleland, Some Self-Similar Integer Sequences S. Northshield, An Analogue of Stern's Sequence for Z[sqrt(2)], Journal of Integer Sequences, 18 (2015), #15.11.6. Kevin Ryde, Iterations of the Terdragon Curve, see index "dir". Robert Walker, Self Similar Sloth Canon Number Sequences FORMULA a(0) = 0, a(3n) = a(n), a(3n+1) = a(n)+1, a(3n+2) = a(n). - Vladeta Jovovic, Jul 18 2001 G.f.: (Sum_{k>=0} x^(3^k)/(1+x^(3^k)+x^(2*3^k)))/(1-x). In general, the generating function for the number of digits equal to d in the base b representation of n (0 < d < b) is (Sum_{k>=0} x^(d*b^k)/(Sum_{i=0..b-1} x^(i*b^k)))/(1-x). - Franklin T. Adams-Watters, Nov 03 2005 [For d=0, use the above formula with d=b: (Sum_{k>=0} x^(b^(k+1))/(Sum_{i=0..b-1} x^(i*b^k)))/(1-x), adding 1 if you consider the representation of 0 to have one zero digit.] a(n) = a(floor(n/3)) + (n mod 3) mod 2. - Paul D. Hanna, Feb 24 2006 MATHEMATICA Table[Count[IntegerDigits[i, 3], 1], {i, 0, 200}] Nest[Join[#, # + 1, #] &, {0}, 5] (* IWABUCHI Yu(u)ki, Sep 08 2012 *) PROG (PARI) a(n)=if(n<1, 0, a(n\3)+(n%3)%2) \\ Paul D. Hanna, Feb 24 2006 (PARI) a(n)=hammingweight(digits(n, 3)%2); \\ Ruud H.G. van Tol, Dec 10 2023 (Haskell) a062756 0 = 0 a062756 n = a062756 n' + m `mod` 2 where (n', m) = divMod n 3 -- Reinhard Zumkeller, Feb 21 2013 (Python) from sympy.ntheory import digits def A062756(n): return digits(n, 3)[1:].count(1) # Chai Wah Wu, Dec 23 2022 CROSSREFS Cf. A080846, A343785 (first differences). Cf. A081606 (indices of !=0). Indices of terms 0..6: A005823, A023692, A023693, A023694, A023695, A023696, A023697. Numbers of: A077267 (0's), A081603 (2's), A160384 (1's+2's). Other bases: A000120, A160381, A268643. Sequence in context: A030372 A065363 A119995 * A360676 A334107 A346700 Adjacent sequences: A062753 A062754 A062755 * A062757 A062758 A062759 KEYWORD nonn,base AUTHOR Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 16 2001 EXTENSIONS More terms from Vladeta Jovovic, Jul 18 2001 STATUS approved

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

Last modified September 13 22:05 EDT 2024. Contains 375910 sequences. (Running on oeis4.)