login
Write natural numbers in base 2 as a stream of digits. Moving left to right, delete odd occurrences of digit 0 and 1.
6

%I #18 Mar 23 2020 17:31:34

%S 1,0,1,0,1,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1,0,1,0,0,1,0,

%T 1,1,0,0,1,1,0,1,0,1,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,1,1,0,1,1,1,0,0,1,

%U 0,0,1,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1

%N Write natural numbers in base 2 as a stream of digits. Moving left to right, delete odd occurrences of digit 0 and 1.

%C The natural numbers in base 2 are 0, 1, 10, 11, 100, 101, 110, 111, 1000..... and define a stream of digits if concatenated:

%C 0110111001011101111000 Delete odd-indexed occurrences of 0 (replaced by .):

%C .110111.01.11101111.0. Also delete odd-indexed occurrences of 1 (replaced by .):

%C ..10.1..01..1.01.1..0.

%C The stream of bits that remain after these two rounds of deletion is chopped into single bits which define the entries of the current sequence.

%o (Sage)

%o def A174205(N=100):

%o a = [0] + flatten([n.digits(base=2)[::-1] for n in IntegerRange(1,N)])

%o for bit in 0, 1:

%o a = [d for i,d in enumerate(a) if not (d == bit and a[:i+1].count(bit) % 2 == 1)]

%o return a # _D. S. McNeil_, Dec 08 2010

%Y Cf. A007088, A174203 - A174210.

%K easy,nonn,base

%O 1,1

%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Mar 15 2010