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.

A140264 Inverse permutation to A140263.

Original entry on oeis.org

0, 1, 2, 5, 7, 3, 6, 4, 8, 17, 19, 15, 23, 25, 21, 11, 13, 9, 18, 16, 20, 12, 10, 14, 24, 22, 26, 53, 55, 51, 59, 61, 57, 47, 49, 45, 71, 73, 69, 77, 79, 75, 65, 67, 63, 35, 37, 33, 41, 43, 39, 29, 31, 27, 54, 52, 56, 48, 46, 50, 60, 58, 62, 36, 34, 38, 30, 28, 32, 42, 40, 44
Offset: 0

Views

Author

Antti Karttunen, May 19 2008

Keywords

Crossrefs

Inverse: A140263.

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 Z(z): return 2*z if z>0 else 2*abs(z) + 1
    def a140266(n): return Z(a117966(n - 1))
    def a(n): return a140266(n + 1) - 1 # Indranil Ghosh, Jun 07 2017
  • Scheme
    (define (A140264 n) (- (A140266 (+ 1 n)) 1))
    

Formula

a(n) = A140266(n+1)-1.