

A340406


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).


3



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, 21, 23, 18, 16, 19, 17, 52, 54, 53, 55, 50, 48, 51, 49, 58, 56, 59, 57, 60, 62, 61, 63, 46, 44, 47, 45, 40, 42, 41, 43, 32, 34, 33, 35, 38, 36, 39, 37, 102, 100, 103
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

This sequence has connections with A003188; their scatterplots are alike.
This sequence appears to be a permutation of the nonnegative integers.


LINKS

Rémy Sigrist, Table of n, a(n) for n = 0..8191
Rémy Sigrist, Scatterplot of the first 2^16 terms


EXAMPLE

The first terms, alongside a(n) XOR a(n+1), are:
n a(n) a(n) XOR a(n+1)
  
0 0 2
1 2 3
2 1 2
3 3 5
4 6 2
5 4 3
6 7 2
7 5 11
8 14 2
9 12 3
10 15 2
11 13 5
12 8 2


PROG

(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)))


CROSSREFS

Cf. A003188, A340446 (cube analog), A340447 (Fibonacci analog).
Sequence in context: A133904 A245182 A209160 * A257881 A268182 A094339
Adjacent sequences: A340403 A340404 A340405 * A340407 A340408 A340409


KEYWORD

nonn,base


AUTHOR

Rémy Sigrist, Jan 06 2021


STATUS

approved



