OFFSET
0,3
COMMENTS
This sequence is a variant of A333400; here we combine initial terms with the XOR operator, there with the addition.
This sequence is well defined; after some initial terms we can extend the sequence with a power of 2 greater that any prior term or even a smaller value.
This sequence is a permutation of the nonnegative integers (with inverse A367263):
- for any k >= 0, the least value >= 2^k is precisely 2^k,
- all powers of 2 appear in the sequence,
- after a power of 2, if the least value not yet in the sequence is less than this power of 2, then this value will be the next term.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
Rémy Sigrist, C++ program
EXAMPLE
The first terms are:
n a(n) a(0) XOR ... XOR a(n)
-- ---- ---------------------
0 0 0
1 1 1
2 2 3
3 4 7
4 3 4
5 6 2
6 7 5
7 8 13
8 5 8
9 14 6
10 9 15
11 16 31
12 10 21
PROG
(C++) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Nov 11 2023
STATUS
approved