login
Self-inverse permutation of nonnegative integers, A054429-conjugate of blue code: a(n) = A054429(A193231(A054429(n))).
8

%I #11 Jun 05 2017 17:36:38

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

%T 26,27,28,29,31,30,53,52,54,55,48,49,51,50,58,59,57,56,63,62,60,61,36,

%U 37,39,38,33,32,34,35,43,42,40,41,46,47,45,44,64,65,67,66

%N Self-inverse permutation of nonnegative integers, A054429-conjugate of blue code: a(n) = A054429(A193231(A054429(n))).

%H Antti Karttunen, <a href="/A234027/b234027.txt">Table of n, a(n) for n = 0..8191</a>

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

%F a(n) = A054429(A193231(A054429(n))).

%F a(n) = A234025(A054429(n)).

%F a(n) = A054429(A234026(n)).

%F a(n) = A059894(A234024(A059894(n))).

%o (Scheme) (define (A234027 n) (A054429 (A193231 (A054429 n))))

%o (Python)

%o def a065621(n): return n^(2*(n - (n&-n)))

%o def a048724(n): return n^(2*n)

%o def a054429(n): return 1 if n==1 else 2*a054429(int(n/2)) + 1 - n%2

%o def a193231(n):

%o if n<2: return n

%o if n%2==0: return a048724(a193231(n/2))

%o else: return a065621(1 + a193231((n - 1)/2))

%o def a(n): return n if n<2 else a054429(a193231(a054429(n))) # _Indranil Ghosh_, Jun 05 2017

%Y Cf. A054429, A059894, A193231, A234024-A234026.

%K nonn

%O 0,3

%A _Antti Karttunen_, Dec 28 2013