cp's OEIS Frontend

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.

A343231 A binary encoding of the nonzero digits in balanced ternary representation of n.

This page as a plain text file.
%I A343231 #12 Apr 09 2021 11:55:23
%S A343231 0,1,3,2,3,7,6,7,5,4,5,7,6,7,15,14,15,13,12,13,15,14,15,11,10,11,9,8,
%T A343231 9,11,10,11,15,14,15,13,12,13,15,14,15,31,30,31,29,28,29,31,30,31,27,
%U A343231 26,27,25,24,25,27,26,27,31,30,31,29,28,29,31,30,31,23
%N A343231 A binary encoding of the nonzero digits in balanced ternary representation of n.
%C A343231 The ones in the binary representation of a(n) correspond to the nonzero digits in the balanced ternary representation of n.
%C A343231 We can extend this sequence to negative indices: a(-n) = a(n) for any n >= 0.
%H A343231 Rémy Sigrist, <a href="/A343231/b343231.txt">Table of n, a(n) for n = 0..6561</a>
%H A343231 Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a>
%F A343231 a(n) = A343228(n) + A343229(n).
%e A343231 The first terms, alongside the balanced ternary representation of n (with "T" instead of digits "-1") and the binary representation of a(n), are:
%e A343231   n   a(n)  ter(n)  bin(a(n))
%e A343231   --  ----  ------  ---------
%e A343231    0     0       0          0
%e A343231    1     1       1          1
%e A343231    2     3      1T         11
%e A343231    3     2      10         10
%e A343231    4     3      11         11
%e A343231    5     7     1TT        111
%e A343231    6     6     1T0        110
%e A343231    7     7     1T1        111
%e A343231    8     5     10T        101
%e A343231    9     4     100        100
%e A343231   10     5     101        101
%e A343231   11     7     11T        111
%e A343231   12     6     110        110
%e A343231   13     7     111        111
%e A343231   14    15    1TTT       1111
%e A343231   15    14    1TT0       1110
%o A343231 (PARI) a(n) = { my (v=0, b=1, t); while (n, t=centerlift(Mod(n, 3)); if (t, v+=b); n=(n-t)\3; b*=2); v }
%Y A343231 Cf. A059095, A140267, A289831, A343228, A343229, A343230.
%K A343231 nonn,look,base
%O A343231 0,3
%A A343231 _Rémy Sigrist_, Apr 08 2021