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 A371276 #10 Mar 18 2024 13:24:09 %S A371276 0,1,2,3,6,7,8,10,17,19,20,21,24,25,29,30,51,52,56,57,60,61,62,64,71, %T A371276 73,74,75,87,88,89,91,152,154,155,156,168,169,170,172,179,181,182,183, %U A371276 186,187,191,192,213,214,218,219,222,223,224,226,260,262,263,264 %N A371276 Nonnegative numbers whose balanced ternary expansions have no consecutive equal digits (with offset 0). %C A371276 Although this is a list, we use an offset equal to 0; thus: %C A371276 - the binary expansion of n has the same number of digits as the balanced ternary expansion of a(n) (ignoring leading zeros), %C A371276 - for n > 0 with binary expansion (b_1, ..., b_w) (where b_1 = 1), let's say that the balanced ternary expansion of a(n) is (t_1, ..., t_w) (where t_1 = 1): %C A371276 - for i = 2..w: %C A371276 - if b_i = 0, then t_i = min({-1, 0, +1} \ {t_{i-1}}), %C A371276 - otherwise, t_i = max({-1, 0, +1} \ {t_{i-1}}). %C A371276 For any w > 0, there are 2^(w-1) positive terms with w balanced ternary digits. %H A371276 Rémy Sigrist, <a href="/A371276/b371276.txt">Table of n, a(n) for n = 0..8191</a> %e A371276 The first terms, alongside their balanced ternary expansions, are: %e A371276 n a(n) bter(a(n)) %e A371276 -- ---- ---------- %e A371276 1 0 0 %e A371276 2 1 1 %e A371276 3 2 1T %e A371276 4 3 10 %e A371276 5 6 1T0 %e A371276 6 7 1T1 %e A371276 7 8 10T %e A371276 8 10 101 %e A371276 9 17 1T0T %e A371276 10 19 1T01 %e A371276 11 20 1T1T %e A371276 12 21 1T10 %e A371276 13 24 10T0 %e A371276 14 25 10T1 %e A371276 15 29 101T %e A371276 16 30 1010 %o A371276 (PARI) is(n) = { while (n, my (d = centerlift(Mod(n, 3))); n = (n-d)/3; if (d==centerlift(Mod(n, 3)), return (0););); return (1); } %o A371276 (PARI) a(n) = { my (d = binary(n)); for (i = 2, #d, d[i] = setminus([-1,0,1], [d[i-1]])[1+d[i]];); fromdigits(d, 3); } %Y A371276 See A031941 for a similar sequence. %Y A371276 Cf. A134021. %K A371276 nonn,base %O A371276 0,3 %A A371276 _Rémy Sigrist_, Mar 17 2024