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.
%I A245812 #29 May 08 2021 11:24:19 %S A245812 0,1,3,2,6,7,4,5,15,14,13,12,11,10,9,8,24,25,26,27,28,29,30,31,16,17, %T A245812 18,19,20,21,22,23,57,56,59,58,61,60,63,62,49,48,51,50,53,52,55,54,41, %U A245812 40,43,42,45,44,47,46,33,32,35,34,37,36,39,38,106,107,104,105,110,111,108,109,98,99,96,97,102,103,100 %N A245812 Self-inverse permutation of natural numbers: a(0) = 0, a(1) = 1, and for n > 1, if A065620(n) < 0, a(n) = A065621(1+a(-(A065620(n)))), otherwise a(n) = A048724(a(A065620(n)-1)). %C A245812 This is an instance of entanglement permutation, where complementary pair A048724/A065621 is entangled with the same pair in the opposite order: A065621/A048724, with a(1) set to 1. %C A245812 Note how this is A193231-conjugate of A054429. %H A245812 Antti Karttunen, <a href="/A245812/b245812.txt">Table of n, a(n) for n = 0..2047</a> %H A245812 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A245812 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A245812 a(0) = 0, a(1) = 1, and for n > 1, if A065620(n) < 0, a(n) = A065621(1+a(-(A065620(n)))), otherwise a(n) = A048724(a(A065620(n)-1)). %F A245812 Equally: %F A245812 a(0) = 0, a(1) = 1, and for n > 1, if A010060(n) = 0, a(n) = A065621(1+a(A246159(n))), otherwise a(n) = A048724(a(A246160(n)-1)). [Note how A246159 is an inverse function for A048724, while A246160 is an inverse function for A065621]. %F A245812 As a composition of related permutations: %F A245812 a(n) = A193231(A234025(n)). %F A245812 a(n) = A234026(A193231(n)). %F A245812 a(n) = A193231(A054429(A193231(n))). %o A245812 (Scheme, with memoizing-macro definec, two equivalent definitions) %o A245812 (definec (A245812 n) (cond ((<= n 1) n) ((negative? (A065620 n)) (A065621 (+ 1 (A245812 (- (A065620 n)))))) (else (A048724 (A245812 (- (A065620 n) 1)))))) %o A245812 (definec (A245812 n) (cond ((<= n 1) n) ((zero? (A010060 n)) (A065621 (+ 1 (A245812 (A246159 n))))) (else (A048724 (A245812 (- (A246160 n) 1)))))) %o A245812 (PARI) %o A245812 a048724(n) = bitxor(n, 2*n); %o A245812 a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2))); %o A245812 a065621(n) = bitxor(n, 2*(n - bitand(n, -n))); %o A245812 a(n) = x=a065620(n); if(n<2, n, if(x<0, a065621(1 + a(-x)), a048724(a(x - 1)))); %o A245812 for(n=0, 100, print1(a(n),", ")) \\ _Indranil Ghosh_, Jun 07 2017 %o A245812 (Python) %o A245812 def a048724(n): return n^(2*n) %o A245812 def a065620(n): return n if n<3 else 2*a065620(n//2) if n%2==0 else -2*a065620((n - 1)//2) + 1 %o A245812 def a065621(n): return n^(2*(n - (n & -n))) %o A245812 def a(n): %o A245812 x=a065620(n) %o A245812 return n if n<2 else a065621(1 + a(-x)) if x<0 else a048724(a(x - 1)) %o A245812 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 07 2017 %Y A245812 Similar or related permutations: A193231, A234025, A234026, A246211, A236854, A235491, A054429, A234027. %Y A245812 Cf. A010060, A048724, A065620, A065621, A246159, A246160. %K A245812 nonn %O A245812 0,3 %A A245812 _Antti Karttunen_, Aug 20 2014