OFFSET
0,3
COMMENTS
This sequence is a permutation of the nonnegative integers (with inverse A370794):- we can always extend the sequence with a power of 2 greater than any prior term,
- for any k >= 0, the first term >= 2^k is precisely 2^k,
- every power of 2 appears in the sequence, in ascending order,
- if a(n) = 2^k and the least value not in the sequence at this point, say v, satisfies v < 2^k, then a(n+1) = v, and eventually every nonnegative integer will appear in the sequence.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
Rémy Sigrist, Scatterplot of the first 500000 terms
Rémy Sigrist, C++ program
Rémy Sigrist, C++ program (faster)
EXAMPLE
The first terms, alongside the bitwise AND of consecutive terms, are:
n a(n) a(n) AND a(n+1)
-- ---- ---------------
0 0 0
1 1 0
2 2 2
3 3 0
4 4 4
5 5 5
6 7 0
7 8 0
8 6 0
9 9 9
10 11 11
11 15 0
12 16 0
PROG
(C++) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 02 2024
STATUS
approved