login
Inverse permutation of A207901: a(n) = A006068(A052331(n)).
5

%I #5 Apr 13 2018 21:55:47

%S 0,1,3,7,15,2,31,6,63,14,127,4,255,30,12,511,1023,62,2047,8,28,126,

%T 4095,5,8191,254,60,24,16383,13,32767,510,124,1022,16,56,65535,2046,

%U 252,9,131071,29,262143,120,48,4094,524287,508,1048575,8190,1020,248,2097151,61,112,25,2044,16382,4194303,11,8388607,32766,32

%N Inverse permutation of A207901: a(n) = A006068(A052331(n)).

%H Antti Karttunen, <a href="/A302029/b302029.txt">Table of n, a(n) for n = 1..4096</a>

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

%F a(n) = A006068(A052331(n)).

%o (PARI)

%o up_to = 4096;

%o v050376 = vector(up_to);

%o ispow2(n) = (n && !bitand(n,n-1));

%o i = 0; for(n=1,oo,if(ispow2(isprimepower(n)), i++; v050376[i] = n); if(i == up_to,break));

%o A052331(n) = { my(s=0,e); while(n > 1, fordiv(n, d, if(((n/d)>1)&&ispow2(isprimepower(n/d)), e = vecsearch(v050376, n/d); if(!e, print("v050376 too short!"); return(1/0)); s += 2^(e-1); n = d; break))); (s); };

%o A006068(n)= { my(s=1, ns); while(1, ns = n >> s; if(0==ns, break()); n = bitxor(n, ns); s <<= 1; ); return (n); } \\ From A006068

%o A302029(n) = A006068(A052331(n));

%Y Inverse of A207901.

%Y One less than A302030.

%K nonn

%O 1,3

%A _Antti Karttunen_, Apr 13 2018