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!)
A140264 Inverse permutation to A140263. 5

%I #15 Jun 10 2017 12:09:45

%S 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,

%T 26,53,55,51,59,61,57,47,49,45,71,73,69,77,79,75,65,67,63,35,37,33,41,

%U 43,39,29,31,27,54,52,56,48,46,50,60,58,62,36,34,38,30,28,32,42,40,44

%N Inverse permutation to A140263.

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

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

%o (Scheme:) (define (A140264 n) (- (A140266 (+ 1 n)) 1))

%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 a140266(n): return Z(a117966(n - 1))

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

%Y Inverse: A140263.

%K nonn

%O 0,3

%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 August 11 05:23 EDT 2024. Contains 375059 sequences. (Running on oeis4.)