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 A163252 #19 Feb 02 2023 19:01:02 %S A163252 0,1,3,2,6,4,5,7,15,11,9,8,10,14,12,13,29,21,17,16,18,19,23,22,20,28, %T A163252 24,25,27,26,30,31,63,47,39,35,33,32,34,38,36,37,45,41,40,42,43,59,51, %U A163252 49,48,50,54,52,53,55,119,87,71,67,65,64,66,70,68,69,77,73,72,74,75,79,78 %N A163252 a(0) = 0, and a(n) is the least positive integer not occurring earlier in the sequence such that a(n-1) and a(n) differ in only one bit when written in binary. %C A163252 Step from a(488) = 237 = 11101101_2 to a(489) = 749 = 1011101101_2 is the first case when one term is two binary digits longer than the previous. Considering the leading zeros, though, they still differ in only one bit. - _Ivan Neretin_, Jun 25 2015 %H A163252 Paul Tek, <a href="/A163252/b163252.txt">Table of n, a(n) for n = 0..10000</a> %F A163252 From _Alois P. Heinz_, Feb 02 2023: (Start) %F A163252 A101080(a(n),a(n+1)) = 1. %F A163252 a(A360307(n)) = n = A360307(a(n)). (End) %p A163252 N:= 10: # to get all terms before the first where a(n) >= 2^N %p A163252 B:= Array(0..2^N-1): %p A163252 B[0]:= 1: %p A163252 a[0]:= 0: %p A163252 L:= Vector([0$N]): %p A163252 for n from 1 do %p A163252 cands:= select(t -> B[t[1]]=0, [seq(`if`(L[i]=0,[a[n-1]+2^(i-1),i],[a[n-1]-2^(i-1),i]),i=1..N)]); %p A163252 if nops(cands)=0 then break fi; %p A163252 j:= min[index](map(t->t[1],cands)); %p A163252 a[n]:= cands[j][1]; %p A163252 i:= cands[j][2]; %p A163252 B[a[n]]:= 1; %p A163252 L[i]:= 1 - L[i]; %p A163252 od: %p A163252 seq(a[i],i=0..n-1); # _Robert Israel_, Jun 25 2015 %t A163252 Nest[Append[#, Min[Complement[BitXor[#[[-1]], 2^Range[0, Floor[Log2[#[[-1]]]] + 2]], #]]] &, {0, 1}, 71] (* _Ivan Neretin_, Jun 25 2015 *) %Y A163252 Cf. A003188, A101080, A360307 (inverse). %K A163252 nonn,base %O A163252 0,3 %A A163252 _Keenan Pepper_, Jul 23 2009