OFFSET
0,1
COMMENTS
Deleting the odd occurrences of 0 and the even occurrences of 1, we get the same sequence apart from the initial 2 replaced by 1 and 0.
EXAMPLE
Numbers in base 2: 0, 1, 10, 11, 100, 101, 110, 111, 1000, .... Delete odd occurrences of 0 (replaced by ~): ~, 1, 10, 11, 1~0, 1~1, 110, 111, 1~0~ Delete odd occurrences of 1 (replaced by ~): ~, ~, 10, ~1, ~~0, 1~~, 1~0, 1~1, ~~0~.
The pieces left are 10, 1, 0, 1, 10, 11, 0, ... which is in base 10: 2, 1, 0, 1, 2, 3, 0, ....
MAPLE
n1 := 1 ; n0 := 1 ;
for n from 0 to 80 do
if n = 0 then b := [0] ; else b := convert(n, base, 2) ; end if;
for d from nops(b) to 1 by -1 do
if op(d, b) = 0 then
if type(n0, 'odd') then b := subsop(d=NULL, b) ; end if; n0 := n0+1 ;
else
if type(n1, 'odd') then b := subsop(d=NULL, b) ; end if; n1 := n1+1 ;
end if;
end do:
add(2^(i-1)*op(i, b), i=1..nops(b)) ; printf("%d, ", %) ;
end do: # R. J. Mathar, Nov 23 2010
KEYWORD
easy,nonn,base,less
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Mar 15 2010
EXTENSIONS
Sequence extended, keyword:base,less added by R. J. Mathar, Nov 23 2010
STATUS
approved