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.

A246208 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 2*a(-(A117966(n))), otherwise a(n) = 1 + 2*a(A117966(n)-1).

Original entry on oeis.org

0, 1, 2, 5, 11, 3, 10, 4, 22, 45, 91, 9, 19, 39, 183, 7, 21, 23, 90, 44, 182, 20, 6, 8, 38, 18, 78, 157, 315, 37, 75, 151, 631, 17, 77, 13, 27, 55, 155, 311, 623, 111, 1263, 35, 303, 47, 181, 43, 365, 41, 89, 367, 15, 79, 314, 156, 630, 76, 16, 36, 150, 74, 302, 180, 46, 88, 14, 366, 42, 40, 364, 12, 54, 26, 110, 34
Offset: 0

Views

Author

Antti Karttunen, Aug 19 2014

Keywords

Comments

This is an instance of entanglement permutation, where complementary pair A117968/A117967 (negative and positive part of inverse of balanced ternary enumeration of integers, respectively) is entangled with complementary pair A005843/A005408 (even and odd numbers respectively), with a(0) set to 0 and a(1) set to 1.
Thus this shares with A140264 the property that apart from a(0) = 0, even numbers occur only in positions given by A117968, and odd numbers only in positions given by A117967.

Crossrefs

Inverse: A246207.
Related permutations: A140264, A054429, A246210, A246211.

Programs

  • Python
    def a117966(n):
        if n==0: return 0
        if n%3==0: return 3*a117966(n//3)
        elif n%3==1: return 3*a117966((n - 1)//3) + 1
        else: return 3*a117966((n - 2)//3) - 1
    def a(n):
        if n<2: return n
        x=a117966(n)
        if x<1: return 2*a(-x)
        else: return 1 + 2*a(x - 1)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017

Formula

a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 2*a(-(A117966(n))), otherwise a(n) = 1 + 2*a(A117966(n)-1).
As a composition of related permutations:
a(n) = A054429(A246210(n)).
a(n) = A246210(A246211(n)).