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.

A289813 A binary encoding of the ones in ternary representation of n (see Comments for precise definition).

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