login
A294994
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
2, 3, 5, 7, 11, 13, 29, 17, 19, 23, 31, 47, 37, 41, 43, 59, 61, 53, 101, 71, 67, 73, 79, 103, 97, 107, 109, 127, 191, 151, 131, 137, 139, 163, 167, 173, 157, 149, 181, 179, 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
OFFSET
1,1
COMMENTS
The Hamming distance between two primes p and q is the Hamming distance between their binary expansions. - N. J. A. Sloane, May 27 2018
Conjecture: this sequence is a permutation of the primes.
By definition, the absolute difference of a(n) and a(n + 1) is in A048645. - David A. Corneth, Jan 12 2018
MATHEMATICA
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]
PROG
(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
CROSSREFS
See also A303593, A303594, A303595 (when n-th prime appears).
Sequence in context: A024694 A024320 A265885 * A292205 A111252 A181525
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Nov 12 2017
STATUS
approved