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.

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

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