OFFSET
0,3
COMMENTS
The original, but now conjectural, alternative definition is:
a(0) = 0 and for n > 0, if there are one or more k_i that are not already present in the sequence among terms a(0) .. a(n-1), and for which bitor(k_i,a(n-1)) = a(n-1), then a(n) = that k_i which gives maximal value of A019565(k_i) amongst them; otherwise, when no such k_i exists, a(n) = the least number not already present that can be obtained by toggling a single 0-bit of a(n-1) to 1. This is done by trying to toggle successive vacant bits from the least significant end of the binary representation of a(n-1), until such a sum a(n-1) + 2^h (= a(n-1) bitxor 2^h) is found that is not already present in the sequence.
The above construction is otherwise identical to that of A303767, except that we choose k_i with the maximal instead of minimal value of A019565.
In contrast to A303767, this sequence is not surjective (and thus not a permutation of nonnegative integers). The first missing term is 13 = A048675(70). See also comments in A303762, A303749 and A302775.
From David A. Corneth, May 05 2018: (Start)
Another description: a(0) = 0. a(n + 1) is the largest a(n) - 2^j > 0 that's not already in the sequence. If no such value exists, a(n + 1) is the least a(n) + 2^j not already in the sequence.
Using this definition we can prove that 13 isn't in the sequence. (End)
The equivalence of these definitions is still conjectural. The official definition of this sequence follows the latter one. - Antti Karttunen, Jun 08 2018
LINKS
FORMULA
From David A. Corneth, May 05 2018: (Start)
MATHEMATICA
Nest[Append[#1, Min@ Select[{#2, #3, 2^IntegerLength[Last@ #1, 2] + Last@ #1}, IntegerQ]] & @@ Function[{a, d}, {a, SelectFirst[Sort@ Map[FromDigits[ReplacePart[d, First@ # -> 1], 2] &, Position[d, 0]], FreeQ[a, #] &], SelectFirst[Sort[#, Greater] &@ Map[FromDigits[ReplacePart[d, First@ # -> 0], 2] &, Position[d, 1]], FreeQ[a, #] &]}] @@ {#, IntegerDigits[Last@ #, 2]} &, {0}, 90] (* Michael De Vlieger, Jun 11 2018 *)
PROG
(PARI)
prepare_v303769(up_to) = { my(v = vector(up_to), occurred = Map(), prev=0, b); mapput(occurred, 0, 0); for(n=1, up_to, b=1; while(b<=prev, if(bitand(prev, b) && !mapisdefined(occurred, prev-b), v[n] = prev-b; break, b <<= 1)); if(!v[n], b=1; while(bitand(prev, b) || mapisdefined(occurred, prev+b), b <<= 1); v[n] = prev+b); mapput(occurred, prev = v[n], n)); (v); };
v303769 = prepare_v303769(16384);
A303769(n) = if(!n, n, v303769[n]); \\ Antti Karttunen, Jun 08 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, May 03 2018, with more direct definition from David A. Corneth, May 05 2018
STATUS
approved