OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Gray Code
MAPLE
brev:= proc(n) local L;
L:= convert(n, base, 2);
add(L[-i]*2^(i-1), i=1..nops(L))
end proc:
select(isprime, [seq(brev(ithprime(i)), i=1..100)]); # Robert Israel, Apr 03 2019
MATHEMATICA
GrayCodeList[k_] := Module[{b = IntegerDigits[k, 2], i}, Do[ If[b[[i - 1]] == 1, b[[i]] = 1 - b[[i]]], {i, Length[b], 2, -1} ]; b ]; a[n_] = GrayCodeList[Prime[n]]; a0 = Table[Sum[a[n][[m + 1]]*2^m, {m, 0, Length[a[n]] - 1}], {n, 1, 200}]; Flatten[Table[If[PrimeQ[a0[[n]]], a0[[n]], {}], {n, 1, 200}]]
PROG
(PARI) forprime(p=2, 1e3, v=binary(p); s=0; forstep(i=#v, 1, -1, s+=s+v[i]); if(isprime(s), print1(s", "))) \\ Charles R Greathouse IV, Nov 07 2011
CROSSREFS
KEYWORD
AUTHOR
Roger L. Bagula and Gary W. Adamson, Oct 21 2008
STATUS
approved