OFFSET
0,3
COMMENTS
Shares with permutations like A003188, A006068, A300838, A302846, A303765, and A303767 the property that when moving from any a(n) to a(n+1) either a subset of 0-bits are toggled on (changed to 1's), or a subset of 1-bits are toggled off (changed to 0's), but no both kind of changes may occur at the same step.
LINKS
EXAMPLE
For a(2), a(1) = 1, and the only subset mask (a number k for which bitor(k,1) = k) is 1 itself, already present, so we start toggling 0's to 1's with binary expansion "...00001" of 1, and we get "11" (= binary representation of 3), and 3 is not yet present, thus a(2) = 3.
For a(3), previous a(2) = 3, "...011" in binary, and "10" (= 2) is the least submask that is not already present, thus a(3) = 2.
For a(4), previous = 2, "...010" in binary, and there are no submasks that are not already used, thus we start toggling 0's to 1's from the right, and "11" (3) is already present, but "111" (7) is not, thus a(4) = 7.
For a(5), previous = 7, with seven submasks "1", "10", "11", "100", "101", "110", "111" (binary representations for 1 - 7), and "100" = 4 is the least one of these not already present, thus a(5) = 4.
For a(6), previous = 4, "..0100" in binary, and no submasks that wouldn't have been already used, thus by toggling from the right, we first obtain "...0101" = 5, which is still free, so a(6) = 5.
For a(7), previous = 5, "..0101" in binary, and no submasks that would be free (both 1 and 4 are already present), thus by toggling zeros from the right, we first obtain "...0111" = 7, which also has been used, so we continue filling the zeros, to obtain next "...1111" = 15, which is still free, so a(7) = 15.
For a(8), previous = 15, "..1111" in binary, and its least unused submask is "110" = 6, thus a(8) = 6.
PROG
(PARI)
up_to = (2^14)-1;
A006519(n) = (2^valuation(n, 2));
v303763 = vector(up_to);
m303764 = Map();
prev=1; for(n=1, up_to, for(m=1, prev, if((bitor(prev, m)==prev) && !mapisdefined(m303764, m), v303763[n] = m; mapput(m303764, m, n); break)); if(!v303763[n], while(mapisdefined(m303764, prev), prev += A006519(1+prev)); v303763[n] = prev; mapput(m303764, prev, n)); prev = v303763[n]);
A303763(n) = if(!n, n, v303763[n]);
A303764(n) = if(!n, n, mapget(m303764, n));
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, May 02 2018
STATUS
approved