|
|
A343231
|
|
A binary encoding of the nonzero digits in balanced ternary representation of n.
|
|
6
|
|
|
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, 9, 11, 10, 11, 15, 14, 15, 13, 12, 13, 15, 14, 15, 31, 30, 31, 29, 28, 29, 31, 30, 31, 27, 26, 27, 25, 24, 25, 27, 26, 27, 31, 30, 31, 29, 28, 29, 31, 30, 31, 23
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
The ones in the binary representation of a(n) correspond to the nonzero digits in the balanced ternary representation of n.
We can extend this sequence to negative indices: a(-n) = a(n) for any n >= 0.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
The first terms, alongside the balanced ternary representation of n (with "T" instead of digits "-1") and the binary representation of a(n), are:
n a(n) ter(n) bin(a(n))
-- ---- ------ ---------
0 0 0 0
1 1 1 1
2 3 1T 11
3 2 10 10
4 3 11 11
5 7 1TT 111
6 6 1T0 110
7 7 1T1 111
8 5 10T 101
9 4 100 100
10 5 101 101
11 7 11T 111
12 6 110 110
13 7 111 111
14 15 1TTT 1111
15 14 1TT0 1110
|
|
PROG
|
(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 }
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|