login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A289813
A binary encoding of the ones in ternary representation of n (see Comments for precise definition).
46
0, 1, 0, 2, 3, 2, 0, 1, 0, 4, 5, 4, 6, 7, 6, 4, 5, 4, 0, 1, 0, 2, 3, 2, 0, 1, 0, 8, 9, 8, 10, 11, 10, 8, 9, 8, 12, 13, 12, 14, 15, 14, 12, 13, 12, 8, 9, 8, 10, 11, 10, 8, 9, 8, 0, 1, 0, 2, 3, 2, 0, 1, 0, 4, 5, 4, 6, 7, 6, 4, 5, 4, 0, 1, 0, 2, 3, 2, 0, 1, 0, 16
OFFSET
0,4
COMMENTS
The ones in the binary representation of a(n) correspond to the ones in the ternary representation of n; for example: ternary(42) = 1120 and binary(a(42)) = 1100 (a(42) = 12).
See A289814 for the sequence encoding the twos in ternary representation of n.
By design, a(n) AND A289814(n) = 0 (where AND stands for the bitwise AND operator).
See A289831 for the sum of this sequence and A289814.
For each pair of numbers without common bits in base 2 representation, say x and y, there is a unique index, say n, such that a(n) = x and A289814(n) = y; in fact, n = A289869(x,y).
The scatterplot of this sequence vs A289814 looks like a Sierpinski triangle pivoted to the side.
For any t > 0: we can adapt the algorithm used here and in A289814 in order to uniquely enumerate every tuple of t numbers mutually without common bits in base 2 representation.
LINKS
FORMULA
a(0) = 0.
a(3*n) = 2 * a(n).
a(3*n+1) = 2 * a(n) + 1.
a(3*n+2) = 2 * a(n).
Also, a(n) = A289814(A004488(n)).
A053735(n) = A000120(a(n)) + 2*A000120(A289814(n)). - Antti Karttunen, Jul 20 2017
EXAMPLE
The first values, alongside the ternary representation of n, and the binary representation of a(n), are:
n a(n) ternary(n) binary(a(n))
-- ---- ---------- ------------
0 0 0 0
1 1 1 1
2 0 2 0
3 2 10 10
4 3 11 11
5 2 12 10
6 0 20 0
7 1 21 1
8 0 22 0
9 4 100 100
10 5 101 101
11 4 102 100
12 6 110 110
13 7 111 111
14 6 112 110
15 4 120 100
16 5 121 101
17 4 122 100
18 0 200 0
19 1 201 1
20 0 202 0
21 2 210 10
22 3 211 11
23 2 212 10
24 0 220 0
25 1 221 1
26 0 222 0
MATHEMATICA
Table[FromDigits[#, 2] &[IntegerDigits[n, 3] /. 2 -> 0], {n, 0, 81}] (* Michael De Vlieger, Jul 20 2017 *)
PROG
(PARI) a(n) = my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==1, 1, 0)), 2)
(PARI) a(n) = fromdigits(digits(n, 3)%2, 2); \\ Ruud H.G. van Tol, May 08 2024
(Python)
from sympy.ntheory.factor_ import digits
def a(n):
d = digits(n, 3)[1:]
return int("".join('1' if i==1 else '0' for i in d), 2)
print([a(n) for n in range(51)]) # Indranil Ghosh, Jul 20 2017
KEYWORD
nonn,base,look
AUTHOR
Rémy Sigrist, Jul 12 2017
STATUS
approved