

A338500


Lexicographically earliest sequence of distinct nonnegative terms such that for any n >= 0, a(n) AND a(n+1) is a square (where AND denotes the bitwise AND operator).


4



0, 1, 2, 4, 3, 5, 6, 8, 7, 9, 11, 13, 16, 10, 17, 12, 18, 20, 14, 21, 24, 19, 28, 32, 15, 25, 22, 33, 23, 36, 26, 37, 27, 29, 34, 64, 30, 48, 31, 41, 65, 35, 68, 38, 44, 39, 52, 45, 54, 69, 40, 66, 49, 51, 53, 46, 80, 42, 81, 43, 73, 47, 84, 50, 72, 55, 57, 67
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

This sequence is a permutation of the nonnegative integers with inverse A334672:
 we can always extend the sequence with a power of 4,
 eventually every power of 4 appears in the sequence,
 a power of 4 is followed by the least value not yet in the sequence,
 so eventually every integer will appear.


LINKS



EXAMPLE

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


PROG

(PARI) See Links section.


CROSSREFS



KEYWORD

nonn,base


AUTHOR



STATUS

approved



