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 A339601 #12 Dec 11 2020 11:36:48 %S A339601 0,1,0,1,0,1,2,3,2,3,2,3,0,1,0,1,0,1,2,3,2,3,2,3,0,1,0,1,0,1,2,3,2,3, %T A339601 2,3,4,5,4,5,4,5,6,7,6,7,6,7,4,5,4,5,4,5,6,7,6,7,6,7,4,5,4,5,4,5,6,7, %U A339601 6,7,6,7,0,1,0,1,0,1,2,3,2,3,2,3,0,1,0,1,0,1,2,3,2,3,2,3,0,1,0,1,0,1,2,3,2,3 %N A339601 Starting from x_0 = n, iterate by dividing with 3 (discarding any remainder), until zero is reached: x_1 = floor(x_0/3), x_2 = floor(x_1/3), etc. Then a(n) = Sum_{i=0..} (x_i AND 2^i), where AND is bitwise-and. %H A339601 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %t A339601 Array[Total@ MapIndexed[BitAnd[2^First[#2 - 1], #1] &, NestWhileList[Floor[#/3] &, #, # > 0 &]] &, 106, 0] (* _Michael De Vlieger_, Dec 10 2020 *) %o A339601 (PARI) A339601(n) = { my(i=0, s=0); while(n, s += bitand(2^i,n); i++; n \= 3); (s); }; %o A339601 (PARI) A339601(n) = { my(m=1, s=0); while(n>=m, s += bitand(m,n); m <<= 1; n \= 3); (s); }; %Y A339601 Cf. A004198, A037095. %Y A339601 Cf. also A332497. %K A339601 nonn,base %O A339601 0,7 %A A339601 _Antti Karttunen_, Dec 09 2020