%I #33 Apr 28 2021 16:27:54
%S 0,1,3,2,7,6,13,12,5,4,25,24,9,8,15,14,11,10,49,48,17,16,23,22,19,18,
%T 27,26,31,30,21,20,29,28,97,96,33,32,39,38,35,34,43,42,47,46,37,36,45,
%U 44,51,50,55,54,61,60,53,52,41,40,57,56,63,62,59,58,193,192,65,64,71,70,67,66,75,74,79,78,69,68,77,76,83,82
%N Permutation of nonnegative integers: a(0) = 0, a(n) = A268717(1 + A268717(n-1)).
%C The "shifted square" of permutation A268717.
%H Antti Karttunen, <a href="/A268821/b268821.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(0) = 0, for n >= 1, a(n) = A268717(1 + A268717(n-1)).
%F Other identities. For all n >= 0:
%F A101080(n, a(n+2)) = 2.
%t A003188[n_]:=BitXor[n, Floor[n/2]]; A006068[n_]:=If[n<2, n, Block[{m = A006068[Floor[n/2]]}, 2m + Mod[Mod[n, 2] + Mod[m, 2], 2]]]; A268717[n_]:=If[n<1, 0, A003188[1 + A006068[n - 1]]]; Table[If[n<2, n, A268717[1 + A268717[n - 1]]], {n, 0, 100}] (* _Indranil Ghosh_, Apr 01 2017 *)
%o (Scheme) (define (A268821 n) (if (zero? n) n (A268717 (+ 1 (A268717 (- n 1))))))
%o (PARI) A003188(n) = bitxor(n, n\2);
%o A006068(n) = if(n<2, n, {my(m = A006068(n\2)); 2*m + (n%2 + m%2)%2});
%o A268717(n) = if(n<1, 0, A003188(1 + A006068(n - 1)));
%o for(n=0, 100, print1(if(n<2, n, A268717(1 + A268717(n - 1))), ", ")) \\ _Indranil Ghosh_, Apr 01 2017
%o (Python)
%o def A003188(n): return n^(n//2)
%o def A006068(n):
%o if n<2: return n
%o else:
%o m=A006068(n//2)
%o return 2*m + (n%2 + m%2)%2
%o def A268717(n): return 0 if n<1 else A003188(1 + A006068(n - 1))
%o def a(n): return A268717(1 + A268717(n-1)) if n>0 else 0
%o print([a(n) for n in range(101)]) # _Indranil Ghosh_, Apr 01 2017
%Y Inverse: A268822.
%Y Row 2 of array A268820.
%Y From term a(2) onward (3, 2, 7, 6, ...) also row 3 of A268715.
%Y Cf. A268717, A268823.
%Y Cf. also A101080, A268833.
%K nonn
%O 0,3
%A _Antti Karttunen_, Feb 14 2016