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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A160384 Number of nonzero digits in the base-3 representation of n. 5
0, 1, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 3, 3, 2, 3, 3, 1, 2, 2, 2, 3, 3, 2, 3, 3, 1, 2, 2, 2, 3, 3, 2, 3, 3, 2, 3, 3, 3, 4, 4, 3, 4, 4, 2, 3, 3, 3, 4, 4, 3, 4, 4, 1, 2, 2, 2, 3, 3, 2, 3, 3, 2, 3, 3, 3, 4, 4, 3, 4, 4, 2, 3, 3, 3, 4, 4, 3, 4, 4, 1, 2, 2, 2, 3, 3, 2, 3, 3, 2, 3, 3, 3, 4, 4, 3, 4, 4, 2, 3, 3, 3, 4, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,5

LINKS

Table of n, a(n) for n=0..104.

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

FORMULA

Recurrence relation: a(0) = 0, a(3m) = a(m), a(3m+1) = a(3m+2) = 1+a(m).

G.f.: (1/(1-z))*Sum_{m>=1} (z^(3^(m-1)) - z^(3^m))/(1 - z^(3^m)).

Morphism: 0, j -> j,j+1,j+1; e.g., 0 -> 011 -> 011122122 -> ...

MATHEMATICA

Join[{0}, Table[IntegerLength[n, 3]-DigitCount[n, 3, 0], {n, 110}]] (* Harvey P. Dale, Jun 21 2015 *)

PROG

(PARI) a(n)=my(d=digits(n, 3)); sum(i=1, #d, !!d[i]) \\ Charles R Greathouse IV, Jan 13 2014

CROSSREFS

Sequence in context: A024693 A025126 A129706 * A178305 A024327 A073044

Adjacent sequences:  A160381 A160382 A160383 * A160385 A160386 A160387

KEYWORD

nonn,base,easy

AUTHOR

Frank Ruskey, Jun 05 2009

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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 23 02:49 EDT 2020. Contains 337291 sequences. (Running on oeis4.)