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.

A254104 Permutation of natural numbers: a(0) = 0, a(3n) = 1 + 2*a(2n - 1), a(3n+1) = 1 + 2*a(2n), a(3n+2) = 2*a(n+1).

Original entry on oeis.org

0, 1, 2, 3, 5, 4, 7, 11, 6, 9, 15, 10, 23, 13, 8, 19, 31, 14, 21, 47, 22, 27, 17, 12, 39, 63, 18, 29, 43, 30, 95, 45, 20, 55, 35, 46, 25, 79, 26, 127, 37, 16, 59, 87, 38, 61, 191, 62, 91, 41, 28, 111, 71, 42, 93, 51, 94, 159, 53, 44, 255, 75, 54, 33, 119, 34, 175, 77, 24, 123, 383, 78, 125, 183, 126, 83, 57, 36, 223, 143, 58, 85, 187, 86, 103, 189, 60
Offset: 0

Views

Author

Antti Karttunen, Jan 25 2015

Keywords

Crossrefs

Programs

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

Formula

a(0) = 0, a(3n) = 1 + 2*a(2n - 1), a(3n+1) = 1 + 2*a(2n), a(3n+2) = 2*a(n+1).
Other identities:
a(A007051(n)) = 2^n for all n >= 0. [A property shared with A064216.]