A289831 a(n) = A289813(n) + A289814(n).
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, 10, 11, 11, 12, 13, 13, 14, 15, 15, 14, 15, 15, 12, 13, 13, 14, 15, 15, 14, 15, 15, 8, 9, 9, 10, 11, 11, 10, 11, 11, 12, 13, 13, 14, 15, 15, 14, 15, 15, 12
Offset: 0
Examples
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 1 2 1 3 2 10 10 4 3 11 11 5 3 12 11 6 2 20 10 7 3 21 11 8 3 22 11 9 4 100 100 10 5 101 101 11 5 102 101 12 6 110 110 13 7 111 111 14 7 112 111 15 6 120 110 16 7 121 111 17 7 122 111 18 4 200 100 19 5 201 101 20 5 202 101 21 6 210 110 22 7 211 111 23 7 212 111 24 6 220 110 25 7 221 111 26 7 222 111
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..6560
Programs
-
Mathematica
Table[FromDigits[Sign@ IntegerDigits[n, 3], 2], {n, 0, 100}] (* Indranil Ghosh, Aug 03 2017 *)
-
PARI
a(n) = my (d=digits(n,3)); fromdigits(vector(#d, i, sign(d[i])), 2)
-
Python
from sympy.ntheory.factor_ import digits from sympy import sign def a(n): d=digits(n, 3)[1:] return int(''.join(str(sign(i)) for i in d), 2) print([a(n) for n in range(101)]) # Indranil Ghosh, Aug 03 2017
Formula
a(0) = 0.
a(3*n) = 2*a(n).
a(3*n + 1) = 2*a(n) + 1.
a(3*n + 2) = 2*a(n) + 1.
Comments