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.

A289831 a(n) = A289813(n) + A289814(n).

This page as a plain text file.
%I A289831 #23 Apr 22 2021 22:03:33
%S A289831 0,1,1,2,3,3,2,3,3,4,5,5,6,7,7,6,7,7,4,5,5,6,7,7,6,7,7,8,9,9,10,11,11,
%T A289831 10,11,11,12,13,13,14,15,15,14,15,15,12,13,13,14,15,15,14,15,15,8,9,9,
%U A289831 10,11,11,10,11,11,12,13,13,14,15,15,14,15,15,12
%N A289831 a(n) = A289813(n) + A289814(n).
%C A289831 The ones in the binary representation of a(n) correspond to the nonzero digits in the ternary representation of n; for example: ternary(42) = 1120 and binary(a(42)) = 1110 (a(42) = 14).
%C A289831 Each number k >= 0 appears 2^A000120(k) times.
%C A289831 a(A004488(n)) = a(n).
%H A289831 Rémy Sigrist, <a href="/A289831/b289831.txt">Table of n, a(n) for n = 0..6560</a>
%F A289831 a(0) = 0.
%F A289831 a(3*n) = 2*a(n).
%F A289831 a(3*n + 1) = 2*a(n) + 1.
%F A289831 a(3*n + 2) = 2*a(n) + 1.
%e A289831 The first values, alongside the ternary representation of n, and the binary representation of a(n), are:
%e A289831 n       a(n)    ternary(n)  binary(a(n))
%e A289831 --      ----    ----------  ------------
%e A289831 0       0       0           0
%e A289831 1       1       1           1
%e A289831 2       1       2           1
%e A289831 3       2       10          10
%e A289831 4       3       11          11
%e A289831 5       3       12          11
%e A289831 6       2       20          10
%e A289831 7       3       21          11
%e A289831 8       3       22          11
%e A289831 9       4       100         100
%e A289831 10      5       101         101
%e A289831 11      5       102         101
%e A289831 12      6       110         110
%e A289831 13      7       111         111
%e A289831 14      7       112         111
%e A289831 15      6       120         110
%e A289831 16      7       121         111
%e A289831 17      7       122         111
%e A289831 18      4       200         100
%e A289831 19      5       201         101
%e A289831 20      5       202         101
%e A289831 21      6       210         110
%e A289831 22      7       211         111
%e A289831 23      7       212         111
%e A289831 24      6       220         110
%e A289831 25      7       221         111
%e A289831 26      7       222         111
%t A289831 Table[FromDigits[Sign@ IntegerDigits[n, 3], 2], {n, 0, 100}] (* _Indranil Ghosh_, Aug 03 2017 *)
%o A289831 (PARI) a(n) = my (d=digits(n,3)); fromdigits(vector(#d, i, sign(d[i])), 2)
%o A289831 (Python)
%o A289831 from sympy.ntheory.factor_ import digits
%o A289831 from sympy import sign
%o A289831 def a(n):
%o A289831     d=digits(n, 3)[1:]
%o A289831     return int(''.join(str(sign(i)) for i in d), 2)
%o A289831 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Aug 03 2017
%Y A289831 Cf. A000120, A004488, A289813, A289814.
%K A289831 nonn,base
%O A289831 0,4
%A A289831 _Rémy Sigrist_, Jul 13 2017