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 A232615 #19 Feb 16 2025 08:33:20 %S A232615 0,1,1,2,2,2,3,3,2,3,3,3,4,4,3,4,4,3,4,4,4,5,5,4,5,5,3,4,4,4,5,5,4,5, %T A232615 5,4,5,5,5,6,6,5,6,6,4,5,5,5,6,6,5,6,6,4,5,5,5,6,6,5,6,6,5,6,6,6,7,7, %U A232615 6,7,7,5,6,6,6,7,7,6,7,7,4,5,5 %N A232615 Variant of the Chandra-sutra (A014701) using 3 instead of 2, and a mod argument using residues 1 and 2. %C A232615 x :> x/3 if x == 0 mod 3, x :> x - x mod 3 otherwise. This sequence gives the number of steps needed to reach 0 or 1. %C A232615 In base 3, number of 0's + (number of other digits - 1) * 2 + (1 if leading digit is 2). %H A232615 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Ternary.html">Ternary.</a> %H A232615 Wikipedia, <a href="http://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a> %e A232615 8 -> 6 -> 2 -> 0. %e A232615 28 -> 27 -> 9 -> 3 -> 1. %e A232615 In base 3 the process is more obvious, e.g., 19 is 201 and the sequence is 201 -> 200 -> 20 -> 2 ->0, so a(19)=4. The number of zeros is 1, other digits is 2 and the leading digit is a 2, so we also have a(19) = 1 + (2-1)*2 + 1 = 4. %o A232615 (JavaScript) %o A232615 for (i=1;i<300;i++) { %o A232615 c=0; %o A232615 n=i; %o A232615 while (n>1) {c++;m=n%3;if (m==0) n/=3; else n-=m;} %o A232615 document.write(c+", "); %o A232615 } %Y A232615 Cf. A014701. %K A232615 nonn,base %O A232615 1,4 %A A232615 _Jon Perry_, Nov 26 2013