%I #13 Jan 10 2021 22:19:34
%S 0,2,1,3,6,4,7,5,14,12,15,13,8,10,9,11,26,24,27,25,28,30,29,31,20,22,
%T 21,23,18,16,19,17,52,54,53,55,50,48,51,49,58,56,59,57,60,62,61,63,46,
%U 44,47,45,40,42,41,43,32,34,33,35,38,36,39,37,102,100,103
%N Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, a(n) XOR a(n+1) is a prime number as small as possible (where XOR denotes the bitwise XOR operator).
%C This sequence has connections with A003188; their scatterplots are alike.
%C This sequence appears to be a permutation of the nonnegative integers.
%H Rémy Sigrist, <a href="/A340406/b340406.txt">Table of n, a(n) for n = 0..8191</a>
%H Rémy Sigrist, <a href="/A340406/a340406.png">Scatterplot of the first 2^16 terms</a>
%e The first terms, alongside a(n) XOR a(n+1), are:
%e n a(n) a(n) XOR a(n+1)
%e -- ---- ---------------
%e 0 0 2
%e 1 2 3
%e 2 1 2
%e 3 3 5
%e 4 6 2
%e 5 4 3
%e 6 7 2
%e 7 5 11
%e 8 14 2
%e 9 12 3
%e 10 15 2
%e 11 13 5
%e 12 8 2
%o (PARI) s=0; v=0; for (n=0, 66, print1 (v", "); s+=2^v; forprime (p=2, oo, if (!bittest(s, w=bitxor(v,p)), v=w; break)))
%Y Cf. A003188, A340446 (cube analog), A340447 (Fibonacci analog).
%K nonn,base
%O 0,2
%A _Rémy Sigrist_, Jan 06 2021