login
A335615
Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, n AND a(n) is a square (where AND denotes the bitwise AND operator).
4
0, 1, 4, 5, 2, 3, 8, 9, 6, 7, 16, 13, 17, 11, 20, 25, 10, 12, 21, 24, 14, 18, 32, 33, 19, 15, 36, 29, 34, 27, 37, 41, 22, 23, 28, 64, 26, 30, 44, 52, 65, 31, 68, 69, 38, 54, 53, 73, 66, 49, 72, 57, 39, 46, 45, 76, 67, 51, 80, 77, 70, 75, 81, 89, 35, 40, 48, 56
OFFSET
0,3
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers.
EXAMPLE
The first terms, alongside the corresponding squares, are:
n a(n) n AND a(n)
-- ---- ----------
0 0 0^2
1 1 1^2
2 4 0^2
3 5 1^2
4 2 0^2
5 3 1^2
6 8 0^2
7 9 1^2
8 6 0^2
9 7 1^2
10 16 0^2
11 13 3^2
12 17 0^2
PROG
(PARI) See Links section.
CROSSREFS
Cf. A338498, A338499 (fixed points), A338500.
Sequence in context: A213171 A261098 A216252 * A328622 A338248 A328623
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 30 2020
STATUS
approved