login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Begin with 2; thereafter a(n) is the least prime not already in the sequence such that the Hamming distance between it and the preceding prime is at most 2.
5

%I #27 May 28 2018 12:19:59

%S 2,3,5,7,11,13,29,17,19,23,31,47,37,41,43,59,61,53,101,71,67,73,79,

%T 103,97,107,109,127,191,151,131,137,139,163,167,173,157,149,181,179,

%U 211,83,89,113,241,193,197,199,223,239,227,229,233,251,379,283,271,263,257,269,277,281,313,307,311,293

%N Begin with 2; thereafter a(n) is the least prime not already in the sequence such that the Hamming distance between it and the preceding prime is at most 2.

%C The Hamming distance between two primes p and q is the Hamming distance between their binary expansions. - _N. J. A. Sloane_, May 27 2018

%C Conjecture: this sequence is a permutation of the primes.

%C By definition, the absolute difference of a(n) and a(n + 1) is in A048645. - _David A. Corneth_, Jan 12 2018

%H Robert G. Wilson v, <a href="/A294994/b294994.txt">Table of n, a(n) for n = 1..10000</a>

%H Rémy Sigrist, <a href="/A294994/a294994.png">Scatterplot of (x, y) such that the prime numbers prime(x) and prime(y) have Hamming distance <= 2 for x = 1..1000 and y = 1..1000</a>

%t f[s_List] := Block[{p = s[[-1]], q = 3}, While[MemberQ[s, q] || Plus @@ IntegerDigits [BitXor[p, q], 2] > 2, q = NextPrime@q]; Append[s, q]]; s = {2}; Nest[f, s, 65]

%o (PARI) s = 0; v = 2; for (n=1, 66, print1 (v ", "); s += 2^v; forprime (p=2, oo, if (!bittest(s, p) && hammingweight(bitxor(p, v))<=2, v = p; break))) \\ _Rémy Sigrist_, Jan 08 2018

%Y Cf. A000040, A004676, A048645, A163252.

%Y See also A303593, A303594, A303595 (when n-th prime appears).

%K nonn,base

%O 1,1

%A _Robert G. Wilson v_, Nov 12 2017