login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A289831 a(n) = A289813(n) + A289814(n). 9
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
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).
Each number k >= 0 appears 2^A000120(k) times.
a(A004488(n)) = a(n).
LINKS
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.
EXAMPLE
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
MATHEMATICA
Table[FromDigits[Sign@ IntegerDigits[n, 3], 2], {n, 0, 100}] (* Indranil Ghosh, Aug 03 2017 *)
PROG
(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
CROSSREFS
Sequence in context: A238756 A025076 A110006 * A335358 A296611 A308661
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 13 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 06:16 EDT 2024. Contains 371782 sequences. (Running on oeis4.)