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.
%I A160384 #27 Jan 26 2020 17:46:08 %S A160384 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, %T A160384 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, %U A160384 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 %N A160384 Number of nonzero digits in the base-3 representation of n. %H A160384 F. T. Adams-Watters, F. Ruskey, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL12/Ruskey2/ruskey14.html">Generating Functions for the Digital Sum and Other Digit Counting Sequences</a>, JIS 12 (2009) 09.5.6 %F A160384 Recurrence relation: a(0) = 0, a(3m) = a(m), a(3m+1) = a(3m+2) = 1+a(m). %F A160384 G.f.: (1/(1-z))*Sum_{m>=1} (z^(3^(m-1)) - z^(3^m))/(1 - z^(3^m)). %F A160384 Morphism: 0, j -> j,j+1,j+1; e.g., 0 -> 011 -> 011122122 -> ... %t A160384 Join[{0},Table[IntegerLength[n,3]-DigitCount[n,3,0],{n,110}]] (* _Harvey P. Dale_, Jun 21 2015 *) %o A160384 (PARI) a(n)=my(d=digits(n,3)); sum(i=1,#d,!!d[i]) \\ _Charles R Greathouse IV_, Jan 13 2014 %K A160384 nonn,base,easy %O A160384 0,5 %A A160384 _Frank Ruskey_, Jun 05 2009