OFFSET
1,1
COMMENTS
a(n) is the i-th prime (as it appears in A000040) for i = 2, 1, 4, 3, 6, 5, 9, 10, 11, 8, 7, 15, 17, 18, 16, 14, etc.
MATHEMATICA
f[n_] := BitXor @@ Table[ Floor[n/2^m], {m, 0, Floor[Log2@ n]}]; Select[ Array[f, 300], PrimeQ]
PROG
(PARI) grayinto(n) = my(B=n); for(k=1, log(n+1)\log(2), B=bitxor(B, n\2^k)); B;
lista(nn) = for (n=1, nn, if (isprime(p=grayinto(n)), print1(p, ", "))); \\ Michel Marcus, Oct 10 2017
(Python)
from itertools import count, islice
from sympy import isprime
def A292204_gen(): # generator of terms
for n in count(0):
k, m = n, n>>1
while m > 0:
k ^= m
m >>= 1
if isprime(k):
yield k
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Sep 11 2017
STATUS
approved