login
Permutation of nonnegative integers: a(n) = A003188(A054429(n)).
10

%I #25 Jun 11 2017 15:15:28

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

%T 31,30,26,27,25,24,32,33,35,34,38,39,37,36,44,45,47,46,42,43,41,40,56,

%U 57,59,58,62,63,61,60,52,53,55,54,50,51,49,48,64,65,67,66

%N Permutation of nonnegative integers: a(n) = A003188(A054429(n)).

%C This permutation transforms the enumeration system of positive irreducible fractions A071766/A229742 (HCS) into the enumeration system A007305/A047679 (Stern-Brocot), and the enumeration system A245325/A245326 into A162909/A162910 (Bird). - _Yosu Yurramendi_, Jun 09 2015

%H Antti Karttunen, <a href="/A233280/b233280.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) = A003188(A054429(n)).

%F a(n) = A063946(A003188(n)).

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

%F a(0)=0, a(1)=1, and otherwise, a(2n) = A000069(1+a(n)), a(2n+1) = A001969(1+a(n)). [A recurrence based on entangling even & odd numbers with odious and evil numbers]

%F a(n) = A258746(A180201(n)) = A180201(A117120(n)), n > 0. - _Yosu Yurramendi_, Apr 10 2017

%o (Scheme)

%o (define (A233280 n) (A003188 (A054429 n)))

%o ;; Alternative version, based on entangling even & odd numbers with odious and evil numbers:

%o (definec (A233280 n) (cond ((< n 2) n) ((even? n) (A000069 (+ 1 (A233280 (/ n 2))))) (else (A001969 (+ 1 (A233280 (/ (- n 1) 2)))))))

%o (R)

%o maxrow <- 8 # by choice

%o a <- 1

%o for(m in 0:maxrow) for(k in 0:(2^m-1)){

%o a[2^(m+1)+ k] <- a[2^m+ k] + 2^m

%o a[2^(m+1)+2^m+k] <- a[2^(m+1)-1-k] + 2^(m+1)

%o }

%o a

%o # _Yosu Yurramendi_, Apr 05 2017

%o (Python)

%o from sympy import floor

%o def a003188(n): return n^(n>>1)

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

%o def a(n): return 0 if n==0 else a003188(a054429(n)) # _Indranil Ghosh_, Jun 11 2017

%Y Inverse permutation: A233279.

%Y Cf. A000069, A001969, A003188, A054429, A063946, A154436.

%Y Similarly constructed permutation pairs: A003188/A006068, A135141/A227413, A232751/A232752, A233275/A233276, A233277/A233278, A193231 (self-inverse).

%K nonn

%O 0,3

%A _Antti Karttunen_, Dec 18 2013