This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A268821 #33 Apr 28 2021 16:27:54 %S A268821 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 A268821 27,26,31,30,21,20,29,28,97,96,33,32,39,38,35,34,43,42,47,46,37,36,45, %U A268821 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 A268821 Permutation of nonnegative integers: a(0) = 0, a(n) = A268717(1 + A268717(n-1)). %C A268821 The "shifted square" of permutation A268717. %H A268821 Antti Karttunen, <a href="/A268821/b268821.txt">Table of n, a(n) for n = 0..8191</a> %H A268821 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A268821 a(0) = 0, for n >= 1, a(n) = A268717(1 + A268717(n-1)). %F A268821 Other identities. For all n >= 0: %F A268821 A101080(n, a(n+2)) = 2. %t A268821 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 A268821 (Scheme) (define (A268821 n) (if (zero? n) n (A268717 (+ 1 (A268717 (- n 1)))))) %o A268821 (PARI) A003188(n) = bitxor(n, n\2); %o A268821 A006068(n) = if(n<2, n, {my(m = A006068(n\2)); 2*m + (n%2 + m%2)%2}); %o A268821 A268717(n) = if(n<1, 0, A003188(1 + A006068(n - 1))); %o A268821 for(n=0, 100, print1(if(n<2, n, A268717(1 + A268717(n - 1))), ", ")) \\ _Indranil Ghosh_, Apr 01 2017 %o A268821 (Python) %o A268821 def A003188(n): return n^(n//2) %o A268821 def A006068(n): %o A268821 if n<2: return n %o A268821 else: %o A268821 m=A006068(n//2) %o A268821 return 2*m + (n%2 + m%2)%2 %o A268821 def A268717(n): return 0 if n<1 else A003188(1 + A006068(n - 1)) %o A268821 def a(n): return A268717(1 + A268717(n-1)) if n>0 else 0 %o A268821 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Apr 01 2017 %Y A268821 Inverse: A268822. %Y A268821 Row 2 of array A268820. %Y A268821 From term a(2) onward (3, 2, 7, 6, ...) also row 3 of A268715. %Y A268821 Cf. A268717, A268823. %Y A268821 Cf. also A101080, A268833. %K A268821 nonn %O A268821 0,3 %A A268821 _Antti Karttunen_, Feb 14 2016