login
This site is supported by donations to The OEIS Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A289814 A binary encoding of the twos in ternary representation of n (see Comments for precise definition). 30
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, 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, 8, 9, 10, 10, 11, 12, 12, 13, 12, 12, 13, 14, 14, 15, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,7

COMMENTS

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).

See A289813 for the sequence encoding the ones in ternary representation of n and additional comments.

LINKS

Rémy Sigrist, Table of n, a(n) for n = 0..6560

FORMULA

a(0) = 0.

a(3*n) = 2 * a(n).

a(3*n+1) = 2 * a(n).

a(3*n+2) = 2 * a(n) + 1.

Also, a(n) = A289813(A004488(n)).

A053735(n) = A000120(A289813(n)) + 2*A000120(a(n)). - Antti Karttunen, Jul 20 2017

EXAMPLE

The first values, alongside the ternary representation of n, and the binary repesentation of a(n), are:

n       a(n)    ternary(n)  binary(a(n))

--      ----    ----------  ------------

0       0       0           0

1       0       1           0

2       1       2           1

3       0       10          0

4       0       11          0

5       1       12          1

6       2       20          10

7       2       21          10

8       3       22          11

9       0       100         0

10      0       101         0

11      1       102         1

12      0       110         0

13      0       111         0

14      1       112         1

15      2       120         10

16      2       121         10

17      3       122         11

18      4       200         100

19      4       201         100

20      5       202         101

21      4       210         100

22      4       211         100

23      5       212         101

24      6       220         110

25      6       221         110

26      7       222         111

MATHEMATICA

Table[FromDigits[#, 2] &[IntegerDigits[n, 3] /. d_ /; d > 0 :> d - 1], {n, 0, 81}] (* Michael De Vlieger, Jul 20 2017 *)

PROG

(PARI) a(n) = my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==2, 1, 0)), 2)

(Python)

from sympy.ntheory.factor_ import digits

def a(n):

    d=digits(n, 3)[1:]

    return int("".join(['1' if i==2 else '0' for i in d]), 2)

print map(a, xrange(101)) # Indranil Ghosh, Jul 20 2017

CROSSREFS

Cf. A000120, A053735, A289813.

Sequence in context: A244442 A246471 A079243 * A304760 A304759 A073438

Adjacent sequences:  A289811 A289812 A289813 * A289815 A289816 A289817

KEYWORD

nonn,base,look

AUTHOR

Rémy Sigrist, Jul 12 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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 15 20:47 EST 2019. Contains 319184 sequences. (Running on oeis4.)