%I #49 Jan 27 2018 02:32:32
%S 0,1,2,3,6,7,4,5,14,15,12,13,10,11,8,9,30,31,28,29,26,27,24,25,22,23,
%T 20,21,18,19,16,17,62,63,60,61,58,59,56,57,54,55,52,53,50,51,48,49,46,
%U 47,44,45,42,43,40,41,38,39,36,37,34,35,32,33,126,127,124,125,122,123,120
%N Permutation of integers a(a(n)) = n. In binary representation of n, transformation of inner bits, 1 <-> 0, gives binary representation of a(n).
%C Primes which stay primes under transformation "opposite inner bits", A092570.
%C This permutation transforms the enumeration system of positive irreducible fractions A020651/A020650 into the enumeration system A245327/A245326, and vice versa. - _Yosu Yurramendi_, Jun 16 2015
%C A117120(a(n)) = a(A117120(n)), n > 0.
%C A258996(a(n)) = a(A258996(n)), n > 0.
%C A258746(a(n)) = a(A258746(n)), n > 0.
%C A054429(a(n)) = a(A054429(n)), n > 0.
%C a(n) = A054429(A065190(n)) = A065190(A054429(n), n > 0. - _Yosu Yurramendi_, Mar 23 2017
%H Michael De Vlieger, <a href="/A092569/b092569.txt">Table of n, a(n) for n = 0..10000</a>
%F a(0) = 0, a(1) = 1, a(2) = 2, a(3) = 3, a(2^(m+1) +k) = a(2^m+k) + 2^(m+1),
%F a(2^(m+1)+2^m+k) = a(2^m+k) + 2^m, m >= 1, 0 <= k < 2^m. - _Yosu Yurramendi_, Apr 02 2017
%e a(9)=15 because 9_10 = 1001_2, transformation of inner bits gives 1001_2 -> 1111_2 = 15_10.
%t bb={0, 1, 2, 3};Do[id=IntegerDigits[n, 2];Do[id[[i]]=1-id[[i]], {i, 2, Length[id]-1}];bb=Append[bb, FromDigits[id, 2]], {n, 4, 1000}];fla=Flatten[bb]
%t (* Second program: *)
%t Table[If[n < 2, n, Function[b, FromDigits[#, 2] &@ Join[{First@ b}, Most[Rest@ b] /. { 0 -> 1, 1 -> 0}, {Last@ b}]]@ IntegerDigits[n, 2]], {n, 0, 70}] (* _Michael De Vlieger_, Apr 03 2017 *)
%o (PARI)T(n)={pow2=2;v=binary(n);L=#v-1;forstep(k=L,2,-1,if(v[k],n-=pow2,n+=pow2);pow2*=2);return(n)};
%o for(n=0,70,print1(T(n),", ")) \\ _Washington Bomfim_, Jan 18 2011
%o (R)
%o maxrow <- 8 # by choice
%o a <- 1:3 # If it were c(1, 3, 2), it would be A054429
%o for(m in 1:maxrow) for(k in 0:(2^m-1)){
%o a[2^(m+1)+ k] = a[2^m+k] + 2^(m+1)
%o a[2^(m+1)+2^m+k] = a[2^m+k] + 2^m
%o }
%o a
%o # _Yosu Yurramendi_, Apr 10 2017
%Y Cf. A092570.
%K nonn,base,easy
%O 0,3
%A _Zak Seidov_, Feb 28 2004
|