%I #37 May 03 2020 06:03:38
%S 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,
%T 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,
%U 1,0,4,5,4,6,7,6,4,5,4,0,1,0,2,3,2,0,1,0,16
%N A binary encoding of the ones in ternary representation of n (see Comments for precise definition).
%C 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).
%C See A289814 for the sequence encoding the twos in ternary representation of n.
%C By design, a(n) AND A289814(n) = 0 (where AND stands for the bitwise AND operator).
%C See A289831 for the sum of this sequence and A289814.
%C 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).
%C The scatterplot of this sequence vs A289814 looks like a Sierpinski triangle pivoted to the side.
%C 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.
%H Rémy Sigrist, <a href="/A289813/b289813.txt">Table of n, a(n) for n = 0..6560</a>
%F a(0) = 0.
%F a(3*n) = 2 * a(n).
%F a(3*n+1) = 2 * a(n) + 1.
%F a(3*n+2) = 2 * a(n).
%F Also, a(n) = A289814(A004488(n)).
%F A053735(n) = A000120(a(n)) + 2*A000120(A289814(n)). - _Antti Karttunen_, Jul 20 2017
%e The first values, alongside the ternary representation of n, and the binary representation of a(n), are:
%e n a(n) ternary(n) binary(a(n))
%e -- ---- ---------- ------------
%e 0 0 0 0
%e 1 1 1 1
%e 2 0 2 0
%e 3 2 10 10
%e 4 3 11 11
%e 5 2 12 10
%e 6 0 20 0
%e 7 1 21 1
%e 8 0 22 0
%e 9 4 100 100
%e 10 5 101 101
%e 11 4 102 100
%e 12 6 110 110
%e 13 7 111 111
%e 14 6 112 110
%e 15 4 120 100
%e 16 5 121 101
%e 17 4 122 100
%e 18 0 200 0
%e 19 1 201 1
%e 20 0 202 0
%e 21 2 210 10
%e 22 3 211 11
%e 23 2 212 10
%e 24 0 220 0
%e 25 1 221 1
%e 26 0 222 0
%t Table[FromDigits[#, 2] &[IntegerDigits[n, 3] /. 2 -> 0], {n, 0, 81}] (* _Michael De Vlieger_, Jul 20 2017 *)
%o (PARI) a(n) = my (d=digits(n,3)); fromdigits(vector(#d, i, if (d[i]==1, 1, 0)), 2)
%o (Python)
%o from sympy.ntheory.factor_ import digits
%o def a(n):
%o d = digits(n, 3)[1:]
%o return int("".join('1' if i==1 else '0' for i in d), 2)
%o print([a(n) for n in range(51)]) # _Indranil Ghosh_, Jul 20 2017
%Y Cf. A000120, A004488, A005836, A053735, A289814, A289831, A289869.
%K nonn,base,look
%O 0,4
%A _Rémy Sigrist_, Jul 12 2017
|