login
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
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.
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
Cf. A334672 (inverse), A335615, A338501.
Sequence in context: A107896 A107897 A133256 * A259570 A334672 A095690
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 31 2020
STATUS
approved