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.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Keywords

Comments

The numbers in base 2: 0, 1, 10, 11, 100, 101, 110, 111, 1000, ....
The infinite stream of digits: 0110111001011101111000...
Delete even (2nd, 4th, 6th, ...) occurrences of 0 (replaced by ~):
011~1110~10111~11110~0...
Delete odd (1st, 3rd, 5th, ...) occurrences of 1 (replaced by ~):
0~1~~1~0~10~1~~1~1~0~0...
Digits remaining define the sequence: 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, ....

Crossrefs

Programs

  • Maple
    nb := 100 ;
    L := [0] ;
    for n from 1 to nb do
        nn := ListTools[Reverse](convert(n,base,2)) ;
        L := [op(L),op(nn)] ;
    end do;
    Lout := [] ;
    ie :=1 ;
    io :=1 ;
    for i from 1 to nops(L) do
        if op(i,L) =0 then
            if ie>0 then
                if type(ie,'odd') then
                    printf("%d,",0) ;
                end if;
            end if;
            ie := ie+1 ;
        else
            if io>0 then
                if type(io,'even') then
                    printf("%d,",1) ;
                end if;
            end if;
            io := io+1 ;
        end if;
    end do: # R. J. Mathar, Dec 06 2011
  • Mathematica
    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 *)