OFFSET
0,3
COMMENTS
This sequence has connections with A109812 (as A109812(n) AND A109812(n+1) = 0) and with A303767 (as A303767(n) AND A303767(n+1) = A303767(n) or A303767(n+1)).
This sequence is a permutation of the nonnegative integers (with inverse A370791):
- 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, PARI program
FORMULA
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 6
7 6 0
8 8 8
9 9 9
10 11 10
11 10 10
12 14 12
13 12 12
14 13 13
15 15 0
16 16 16
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 02 2024
STATUS
approved