A232615 Variant of the Chandra-sutra (A014701) using 3 instead of 2, and a mod argument using residues 1 and 2.
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, 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, 6, 7, 7, 5, 6, 6, 6, 7, 7, 6, 7, 7, 4, 5, 5
Offset: 1
Examples
8 -> 6 -> 2 -> 0. 28 -> 27 -> 9 -> 3 -> 1. 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.
Links
- Eric Weisstein's World of Mathematics, Ternary.
- Wikipedia, Ternary numeral system
Crossrefs
Cf. A014701.
Programs
-
JavaScript
for (i=1;i<300;i++) { c=0; n=i; while (n>1) {c++;m=n%3;if (m==0) n/=3; else n-=m;} document.write(c+", "); }
Comments