cp's OEIS Frontend

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.

A182209 a(n) is the least m >= n, such that the Hamming distance D(n,m) = 3.

This page as a plain text file.
%I A182209 #44 Jul 10 2021 04:20:48
%S A182209 7,6,5,4,9,8,8,9,15,14,13,12,16,17,18,19,23,22,21,20,25,24,24,25,31,
%T A182209 30,29,28,36,37,38,39,39,38,37,36,41,40,40,41,47,46,45,44,48,49,50,51,
%U A182209 55,54,53,52,57,56,56,57,63,62,61,60,76,77,78,79,71,70,69
%N A182209 a(n) is the least m >= n, such that the Hamming distance D(n,m) = 3.
%C A182209 a(n) = n<+>3 (see comment in A206853).
%H A182209 Alois P. Heinz, <a href="/A182209/b182209.txt">Table of n, a(n) for n = 0..10000</a>
%F A182209 If n==i mod 8, then a(n) = n-2*i+7, i=0,1,2,3;  if n==4 mod 16, then a(n) = n+5; if n==12 mod 16, then  a(n) = n+2^(A007814(n+4)-2); if n==5 mod 16, then a(n) = n+3; if n==13 mod 16, then  a(n) = n+2^(A007814(n+3)-2); if n==6 mod 8, then a(n) = n+2^(A007814(n+2)-2); if n==7 mod 8, then a(n) = n+2^(A007814(n+1)-2).
%F A182209 Using this formula, we can prove conjecture formulated in comment in A209554 in case k=3. Moreover, one can prove that N could be represented in form n<+>2 or n<+>3 iff N is not a number of the forms 32*t, 32*t+1. - _Vladimir Shevelev_, Apr 25 2012
%p A182209 HD:= (i, j)-> add(h, h=Bits[Split](Bits[Xor](i, j))):
%p A182209 a:= proc(n) local c;
%p A182209       for c from n do if HD(n, c)=3 then return c fi od
%p A182209     end:
%p A182209 seq(a(n), n=0..100);  # _Alois P. Heinz_, Apr 18 2012
%o A182209 (Python)
%o A182209 def d(n, m): return bin(n^m).count('1')
%o A182209 def a(n):
%o A182209     m = n+1
%o A182209     while d(n, m) != 3: m += 1
%o A182209     return m
%o A182209 print([a(n) for n in range(67)]) # _Michael S. Branicky_, Jul 06 2021
%o A182209 (PARI) a(n) = bitxor(n, if(bitand(n,14)==4, 13, 7<<valuation(n>>2+1,2))); \\ _Kevin Ryde_, Jul 10 2021
%Y A182209 Cf. A086799 ((n-1)<+>1), A182187 (n<+>2), A182336 (n<+>4).
%Y A182209 Cf. A209554 (primes which are not terms nor n<+>2 terms).
%Y A182209 Cf. A205509, A205510, A205511, A205302, A205649, A205533, A122565, A206852, A206960, A007814.
%K A182209 nonn,base,easy
%O A182209 0,1
%A A182209 _Vladimir Shevelev_, Apr 18 2012