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.
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
Links
Crossrefs
Programs
-
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]
-
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
Comments