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 A182187 #59 Jul 09 2021 21:50:36 %S A182187 3,2,4,5,7,6,10,11,11,10,12,13,15,14,22,23,19,18,20,21,23,22,26,27,27, %T A182187 26,28,29,31,30,46,47,35,34,36,37,39,38,42,43,43,42,44,45,47,46,54,55, %U A182187 51,50,52,53,55,54,58,59,59,58,60,61,63,62,94,95,67,66,68 %N A182187 a(n) is the least m >= n such that the Hamming distance D(n,m) = 2. %C A182187 a(n) = n<+>2 (see comment in A206853). %H A182187 Alois P. Heinz, <a href="/A182187/b182187.txt">Table of n, a(n) for n = 0..1000</a> %F A182187 If n is odd, then a(n) = n+2^(A007814(n+1)-1); if n == 2 (mod 4), then a(n) = n+2^(A007814(n+2)-1); if n == 0 (mod 4), then a(n) = n+3. %F A182187 Using this formula, we can prove the conjecture formulated in comment in A209554 in the case k=2. Moreover, let us show that if N does not have the form 8*t or 8*t+1, then it can be represented in the form n<+>2. Indeed, in the cases N = 8*t+2, 8*t+4, 8*t+6, 8*t+3, 8*t+5 and 8*t+7 it is sufficient to choose n=N-4, n=N-2, n=N-1, n=N-3, n=N-2 and n = N-3 respectively; in the cases 8*t, 8*t+1, for every choice of n <= N, we do not obtain the equality n<+>2 = N. %F A182187 In addition, note that n<+>1 = n + 2^A007814(n+1) = A086799(n+1). %p A182187 HD:= (i, j)-> add(h, h=Bits[Split](Bits[Xor](i, j))): %p A182187 a:= proc(n) local c; %p A182187 for c from n do if HD(n, c)=2 then return c fi od %p A182187 end: %p A182187 seq(a(n), n=0..100); # _Alois P. Heinz_, Apr 17 2012 %t A182187 t={}; Do[i=n+1; While[Count[IntegerDigits[BitXor[n,i],2],1]!=2,i++]; AppendTo[t,i],{n,0,66}]; t (* _Jayanta Basu_, May 26 2013 *) %o A182187 (Sage) %o A182187 def A182187(n): %o A182187 S = n.bits(); T = S; c = n; L = len(S) %o A182187 while true: %o A182187 H = sum(a != b for a, b in zip(S, T)) %o A182187 if H == 2: return c %o A182187 c += 1; T = c.bits() %o A182187 if len(T) > L: L += 1; S.append(0) %o A182187 [A182187(n) for n in (0..66)] # _Peter Luschny_, May 26 2013 %o A182187 (Python) %o A182187 def a(n): %o A182187 m = n + 1 %o A182187 while bin(n^m).count('1') != 2: m += 1 %o A182187 return m %o A182187 print([a(n) for n in range(67)]) # _Michael S. Branicky_, Mar 02 2021 %o A182187 (PARI) a(n) = bitxor(n, 3<<valuation(n>>1+1,2)); \\ _Kevin Ryde_, Jul 09 2021 %Y A182187 Cf. A206853 (trajectory of 1), A207063 (trajectory of 0). %Y A182187 Cf. A209544 (primes which are not terms), A209554 (and also not n<+>3). %Y A182187 Cf. A086799 ((n-1)<+>1), A182209 (n<+>3), A182336 (n<+>4). %Y A182187 Cf. A205509, A205510, A205511, A205302, A205649, A205533, A122565, A206852, A206960, A007814. %K A182187 nonn,base,easy %O A182187 0,1 %A A182187 _Vladimir Shevelev_, Apr 17 2012 %E A182187 More terms from _Alois P. Heinz_, Apr 17 2012