cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A174207 Depleted stream of the natural numbers written in base 2: delete even occurrences of digit 0 and odd occurrences of digit 1.

This page as a plain text file.
%I A174207 #14 May 12 2019 02:18:02
%S A174207 0,1,1,0,1,0,1,1,1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,0,0,1,0,0,1,0,1,0,
%T A174207 1,0,1,0,1,0,1,1,0,1,1,1,0,0,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,0,0,
%U A174207 1,0,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,1,1,0,0,1,0,0
%N A174207 Depleted stream of the natural numbers written in base 2: delete even occurrences of digit 0 and odd occurrences of digit 1.
%C A174207 The numbers in base 2: 0, 1, 10, 11, 100, 101, 110, 111, 1000, ....
%C A174207 The infinite stream of digits: 0110111001011101111000...
%C A174207 Delete even (2nd, 4th, 6th, ...) occurrences of 0 (replaced by ~):
%C A174207 011~1110~10111~11110~0...
%C A174207 Delete odd (1st, 3rd, 5th, ...) occurrences of 1 (replaced by ~):
%C A174207 0~1~~1~0~10~1~~1~1~0~0...
%C A174207 Digits remaining define the sequence: 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, ....
%p A174207 nb := 100 ;
%p A174207 L := [0] ;
%p A174207 for n from 1 to nb do
%p A174207     nn := ListTools[Reverse](convert(n,base,2)) ;
%p A174207     L := [op(L),op(nn)] ;
%p A174207 end do;
%p A174207 Lout := [] ;
%p A174207 ie :=1 ;
%p A174207 io :=1 ;
%p A174207 for i from 1 to nops(L) do
%p A174207     if op(i,L) =0 then
%p A174207         if ie>0 then
%p A174207             if type(ie,'odd') then
%p A174207                 printf("%d,",0) ;
%p A174207             end if;
%p A174207         end if;
%p A174207         ie := ie+1 ;
%p A174207     else
%p A174207         if io>0 then
%p A174207             if type(io,'even') then
%p A174207                 printf("%d,",1) ;
%p A174207             end if;
%p A174207         end if;
%p A174207         io := io+1 ;
%p A174207     end if;
%p A174207 end do: # _R. J. Mathar_, Dec 06 2011
%t A174207 nMax = 60; bits = Join @@ Table[IntegerDigits[n, 2], {n, 0, nMax}]; pos0 = Position[bits, 0] // Flatten; even0 = Partition[pos0, 2][[All, 2]]; bits2 = ReplacePart[bits, Alternatives @@ even0 -> "~"]; pos1 = Position[bits2, 1] // Flatten; odd1 = Partition[pos1, 2][[All, 1]]; DeleteCases[ ReplacePart[ bits2, Alternatives @@ odd1 -> "~"], "~"] (* _Jean-François Alcover_, Nov 18 2016 *)
%Y A174207 Cf. A174203, A174204 (base 10), A174205, A174206, A174208-A174210.
%K A174207 easy,nonn,base
%O A174207 0,1
%A A174207 _Paolo P. Lava_ and _Giorgio Balzarotti_, Mar 15 2010