login
Interleave the Gray-coded X and Y-coordinates of 2-dimensional Hilbert's curve in alternate bit-positions: a(n) = A000695(A003188(A059253(n))) + 2*A000695(A003188(A059252(n))).
15

%I #21 Apr 15 2018 15:07:00

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

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

%U 37,39,38,46,44,45,47,43,41,40,42,34,35,33,32,160,162,163,161,165,164,166,167,175,174,172,173,169,171,170,168,136

%N Interleave the Gray-coded X and Y-coordinates of 2-dimensional Hilbert's curve in alternate bit-positions: a(n) = A000695(A003188(A059253(n))) + 2*A000695(A003188(A059252(n))).

%C Like in binary Gray code A003188, also in this permutation the binary expansions of a(n) and a(n+1) differ always by just a single bit-position, that is, A000120(A003987(a(n),a(n+1))) = 1 for all n >= 0. Here A003987 computes bitwise-XOR of its two arguments.

%C When composed with A052330 this gives A302781.

%H Antti Karttunen, <a href="/A302846/b302846.txt">Table of n, a(n) for n = 0..16383</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

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

%F a(n) = A000695(A003188(A059253(n))) + 2*A000695(A003188(A059252(n))).

%F a(n) = A064706(A163356(n)) = A003188(A302844(n)).

%o (PARI)

%o A064706(n) = bitxor(n, n>>2);

%o A057300(n) = { my(t=1,s=0); while(n>0, if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };

%o A163356(n) = if(!n,n,my(i = (#binary(n)-1)\2, f = 4^i, d = (n\f)%4, r = (n%f)); (((((2+(i%2))^d)%5)-1)*f) + if(3==d,f-1-A163356(r),A057300(A163356(r))));

%o A302846(n) = A064706(A163356(n));

%Y Cf. A302845 (inverse permutation).

%Y Cf. A000695, A302844, A057300, A059252, A059253, A064706, A163356, A302781.

%Y Cf. also A003188, A163252, A300838 for other permutations satisfying the same condition.

%K nonn,base

%O 0,3

%A _Antti Karttunen_, Apr 14 2018