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).
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
Rémy Sigrist, Table of n, a(n) for n = 0..6560
FORMULA
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
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Jul 12 2017
STATUS
approved