OFFSET
1,2
COMMENTS
This sequence is a permutation of the positive integers. n - 2^floor(log(n)/log(2)) + 1 = A062050(n).
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..8191
EXAMPLE
The first 6 terms of the sequence are 1,2,4,3,6,8. Now 7 - 2^floor(log(7)/log(2)) + 1 = 4. So we want the 4th term of those positive integers not occurring among the first 6 terms of the sequence (i.e., the 4th term among 5,7,9,10,11,...). So a(7) = 10.
MATHEMATICA
Fold[Append[#1, Complement[Range[Max[#1] + #2], #1][[#2]]] &, {1},
Flatten@Table[Range[2^k], {k, 6}]] (* Ivan Neretin, Sep 24 2021 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Leroy Quet, Jun 11 2006
EXTENSIONS
Extended by Ray Chandler, Jun 19 2006
STATUS
approved