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 A268718 #31 Jun 06 2025 00:08:52 %S A268718 0,1,4,2,6,8,3,7,10,12,15,11,5,13,16,14,18,20,23,19,29,21,24,22,9,25, %T A268718 28,26,30,32,27,31,34,36,39,35,45,37,40,38,57,41,44,42,46,48,43,47,17, %U A268718 49,52,50,54,56,51,55,58,60,63,59,53,61,64,62,66,68,71,67,77,69,72,70,89,73,76,74,78,80,75,79,113,81 %N A268718 Permutation of natural numbers: a(0) = 0, a(n) = 1 + A003188(A006068(n)-1), where A003188 is binary Gray code and A006068 is its inverse. %H A268718 Antti Karttunen, <a href="/A268718/b268718.txt">Table of n, a(n) for n = 0..8191</a> %H A268718 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A268718 a(0) = 0, and for n >= 1, a(n) = A105081(A006068(n)) = 1 + A003188(A006068(n)-1). %F A268718 Other identities. For all n >= 1: %F A268718 a(A128309(n)) = A128309(n)+2. [Maps any even odious number to that number + 2.] %F A268718 From _Alan Michael Gómez Calderón_, May 29 2025: (Start) %F A268718 a(n) - 1 = A268717(n+1) XOR (A171977(n)+1) for n >= 1; %F A268718 a(2*n-1) - 1 = (2-A010060(n-1)) XOR (A166519(n-1)-1) for n >= 1; %F A268718 a(2*n) - 1 = (a(2*(n+1)-1)-1) XOR 2^A277822(n) for n >= 1. (End) %t A268718 {0}~Join~Table[1 + BitXor[#, Floor[#/2]] &[BitXor @@ Table[Floor[n/2^m], {m, 0, Floor[Log[2, n]]}] - 1], {n, 81}] (* _Michael De Vlieger_, Feb 29 2016, after _Jean-François Alcover_ at A006068 and _Robert G. Wilson v_ at A003188 *) %o A268718 (Scheme) (define (A268718 n) (if (zero? n) n (A105081 (A006068 n)))) %o A268718 (PARI) %o A268718 a003188(n)=bitxor(n, n>>1); %o A268718 a006068(n)= { %o A268718 my( s=1, ns ); %o A268718 while ( 1, %o A268718 ns = n >> s; %o A268718 if ( 0==ns, break() ); %o A268718 n = bitxor(n, ns); %o A268718 s <<= 1; %o A268718 ); %o A268718 return (n); %o A268718 } \\ by _Joerg Arndt_ %o A268718 a(n)=if(n==0, 0, 1 + a003188(a006068(n) - 1)); \\ _Indranil Ghosh_, Jun 07 2017 %o A268718 (Python) %o A268718 def a003188(n): return n^(n>>1) %o A268718 def a006068(n): %o A268718 s=1 %o A268718 while True: %o A268718 ns=n>>s %o A268718 if ns==0: break %o A268718 n=n^ns %o A268718 s<<=1 %o A268718 return n %o A268718 def a(n): return 0 if n==0 else 1 + a003188(a006068(n) - 1) # _Indranil Ghosh_, Jun 07 2017 %Y A268718 Inverse: A268717. %Y A268718 Cf. A003188, A006068, A010060, A105081, A128309, A166519, A171977, A277822. %Y A268718 Row 1 of array A268830. %Y A268718 Cf. A092246 (fixed points). %Y A268718 Cf. A268818 ("square" of this permutation). %Y A268718 Cf. A268822 ("shifted square"), A268824 ("shifted cube") and also A268826, A268828 and A268832 (higher "shifted powers"). %K A268718 nonn %O A268718 0,3 %A A268718 _Antti Karttunen_, Feb 12 2016