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.

A030317 Write the odd numbers 2n - 1 in base 2 and juxtapose these binary expansions; read the result bit-by-bit.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1
Offset: 1

Views

Author

Keywords

Examples

			1 in binary is 1.
3 in binary is 11.
5 in binary is 101.
7 in binary is 111.
9 in binary is 1001.
Putting those together, we obtain 1111011111001. Then, splitting bit by bit, we get 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, the beginning of this sequence.
		

Crossrefs

Cf. A099821 (odd positive integers in base 2).

Programs

  • Maple
    twon := 1 :
    dig := 1:
    A030317 := proc()
        global twon,dig ;
        local a,dgs;
        dgs := convert(twon,base,2) ;
        a := op(-dig,%) ;
        if dig = nops(dgs) then
            twon := twon+2 ;
            dig :=1 ;
        else
            dig := dig+1 ;
        end if;
        return a;
    end proc:
    seq(A030317(),n=1..100) ; # R. J. Mathar, Jul 22 2025
  • Mathematica
    Flatten[Table[IntegerDigits[2n - 1, 2], {n, 50}]] (* Harvey P. Dale, Aug 06 2013 *)
  • Scala
    (1 to 31 by 2).map(Integer.toString(, 2)).mkString.split("").map(Integer.parseInt()).toList // Alonso del Arte, Feb 10 2020