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!)
A140266 Inverse permutation to A140265. 3

%I #13 Jun 07 2017 05:25:31

%S 1,2,3,6,8,4,7,5,9,18,20,16,24,26,22,12,14,10,19,17,21,13,11,15,25,23,

%T 27,54,56,52,60,62,58,48,50,46,72,74,70,78,80,76,66,68,64,36,38,34,42,

%U 44,40,30,32,28,55,53,57,49,47,51,61,59,63,37,35,39,31,29,33,43,41,45

%N Inverse permutation to A140265.

%H A. Karttunen, <a href="/A140266/b140266.txt">Table of n, a(n) for n = 1..729</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(n) = Z->N(A117966(n-1)), where Z->N(z) = 2z if z>0 else 2|z|+1.

%o (Scheme:) (string-append (define (A140266 n) (Z->N (A117966 (- n 1))))

%o (define (Z->N n) (if (positive? n) (* n 2) (+ 1 (* 2 (- n))))))

%o (Python)

%o def a117966(n):

%o if n==0: return 0

%o if n%3==0: return 3*a117966(n/3)

%o elif n%3==1: return 3*a117966((n - 1)/3) + 1

%o else: return 3*a117966((n - 2)/3) - 1

%o def Z(z): return 2*z if z>0 else 2*abs(z) + 1

%o def a(n): return Z(a117966(n - 1)) # _Indranil Ghosh_, Jun 07 2017

%Y Inverse: A140265. a(n) = A140264(n-1)+1.

%K nonn,look,hear

%O 1,2

%A _Antti Karttunen_, May 19 2008

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 23 20:33 EDT 2024. Contains 371916 sequences. (Running on oeis4.)