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 A371256 #16 Mar 17 2024 15:10:48 %S A371256 0,1,1,2,3,2,2,2,3,4,5,5,6,7,6,5,5,4,4,5,5,5,4,5,6,6,7,8,9,9,10,11,10, %T A371256 10,10,11,12,13,13,14,15,14,13,13,12,11,10,10,10,11,10,9,9,8,8,9,9,10, %U A371256 11,10,10,10,11,11,10,10,9,8,9,10,10,11,12,13,13 %N A371256 The run lengths transform of the ternary expansion of n corresponds to the run lengths transform of the binary expansion of a(n). %C A371256 For any v >= 0, the value v appears 2^A005811(v) times in the sequence. %H A371256 Rémy Sigrist, <a href="/A371256/b371256.txt">Table of n, a(n) for n = 0..6561</a> %F A371256 a(A005823(n)) = n - 1. %F A371256 a(A005836(n)) = n - 1. %F A371256 a(A004488(n)) = a(n). %F A371256 abs(a(n+1) - a(n)) <= 1. %e A371256 The first terms, alongside the ternary expansion of n and the binary expansion of a(n), are: %e A371256 n a(n) ter(n) bin(a(n)) %e A371256 -- ---- ------ --------- %e A371256 0 0 0 0 %e A371256 1 1 1 1 %e A371256 2 1 2 1 %e A371256 3 2 10 10 %e A371256 4 3 11 11 %e A371256 5 2 12 10 %e A371256 6 2 20 10 %e A371256 7 2 21 10 %e A371256 8 3 22 11 %e A371256 9 4 100 100 %e A371256 10 5 101 101 %e A371256 11 5 102 101 %e A371256 12 6 110 110 %e A371256 13 7 111 111 %e A371256 14 6 112 110 %e A371256 15 5 120 101 %o A371256 (PARI) a(n) = { my (r = [], d, l, v = 0); while (n, d = n%3; l = 0; while ((n%3)==d, n\=3; l++;); r = concat(l, r);); for (k = 1, #r, v = (v+k%2)*2^r[k]-k%2); v } %Y A371256 See A371263 for a similar sequence. %Y A371256 Cf. A004488, A005811, A005823, A005836, A101211, A166242, A371257. %K A371256 nonn,base,easy %O A371256 0,4 %A A371256 _Rémy Sigrist_, Mar 16 2024