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.

Showing 1-1 of 1 results.

A383669 Numbers whose binary representation has a positive number of 0s, all with odd runlength.

Original entry on oeis.org

2, 5, 6, 8, 10, 11, 13, 14, 17, 21, 22, 23, 24, 26, 27, 29, 30, 32, 34, 35, 40, 42, 43, 45, 46, 47, 49, 53, 54, 55, 56, 58, 59, 61, 62, 65, 69, 70, 71, 81, 85, 86, 87, 88, 90, 91, 93, 94, 95, 96, 98, 99, 104, 106, 107, 109, 110, 111, 113, 117, 118, 119, 120
Offset: 1

Views

Author

Clark Kimberling, May 15 2025

Keywords

Examples

			The binary representation 40 is 101000, so 40 is in the sequence.
		

Crossrefs

Programs

  • Maple
    with(priqueue):
    R:= NULL: count:= 0:
    q:= 1:
    initialize(pq);
    insert([-1],pq);
    while count < 100 do
      t:= op(extract(pq));
      if t = -q then q:= 2*q+1
      else R:= R,-t; count:= count+1;
      fi;
      insert([2*t-1],pq);
      if t::odd then insert([2*t],pq)
      else insert([4*t],pq)
      fi;
    od:
    R; # Robert Israel, Jun 16 2025
  • Mathematica
    Map[#[[1]] &, Cases[Map[{#, # =!= {} && Apply[And, OddQ[StringLength[#]]] &[StringCases[IntegerString[#, 2], "0" ..]]} &, Range[400]], {, True}]] (* _Peter J. C. Moses, Apr 23 2025 *)
  • Python
    def ok(n): return n&(n+1) > 0 and all(run == '' or len(run) % 2 for run in bin(n)[2:].split('1'))
    print([n for n in range(121) if ok(n)]) # David Radcliffe, Jun 16 2025
Showing 1-1 of 1 results.