login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A081603 Number of 2's in ternary representation of n. 29
0, 0, 1, 0, 0, 1, 1, 1, 2, 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 3, 0, 0, 1, 0, 0, 1, 1, 1, 2, 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, 1, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 3, 3, 4, 0, 0, 1, 0, 0, 1, 1, 1, 2, 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,9

COMMENTS

A077267(n) + A062756(n) + a(n) = A081604(n);

a(n) = (A053735(n) - A062756(n))/2.

Fixed point of the morphism : 0 ->001 ; 1 ->112 ; 2 ->223 ; 3 ->334, etc , starting from a(0)=0. - Philippe Deléham, Oct 26 2011

LINKS

R. Zumkeller, Table of n, a(n) for n = 0..10000

F. T. Adams-Waters, F. Ruskey, Generating Functions for the Digital Sum and Other Digit Counting Sequences, JIS 12 (2009) 09.5.6

Eric Weisstein's World of Mathematics, Ternary.

FORMULA

a(n) = if n<3 then [n/2] else a([n/3]) + [(n mod 3)/2].

MAPLE

A081603 := proc(n)

    local a, d ;

    a := 0 ;

    for d in convert(n, base, 3) do

        if d= 2 then

            a := a+1 ;

        end if;

    end do:

    a;

end proc: # R. J. Mathar, Jul 12 2016

MATHEMATICA

Table[Count[IntegerDigits[n, 3], 2], {n, 0, 6!}] (* Vladimir Joseph Stephan Orlovsky, Jul 25 2009 *)

Nest[ Flatten[# /. a_Integer -> {a, a, a + 1}] &, {0}, 5] (* Robert G. Wilson v, May 20 2014 *)

PROG

(Haskell)

a081603 0 = 0

a081603 n = a081603 n' + m `div` 2 where (n', m) = divMod n 3

-- Reinhard Zumkeller, Feb 21 2013

CROSSREFS

Cf. A007089, A074940, A005836, A081610, A081611.

Sequence in context: A147645 A091970 A093955 * A273513 A165277 A245194

Adjacent sequences:  A081600 A081601 A081602 * A081604 A081605 A081606

KEYWORD

nonn,base

AUTHOR

Reinhard Zumkeller, Mar 23 2003

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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 20 15:22 EDT 2018. Contains 316388 sequences. (Running on oeis4.)