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.

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

This page as a plain text file.
%I A383669 #14 Jun 18 2025 01:00:44
%S A383669 2,5,6,8,10,11,13,14,17,21,22,23,24,26,27,29,30,32,34,35,40,42,43,45,
%T A383669 46,47,49,53,54,55,56,58,59,61,62,65,69,70,71,81,85,86,87,88,90,91,93,
%U A383669 94,95,96,98,99,104,106,107,109,110,111,113,117,118,119,120
%N A383669 Numbers whose binary representation has a positive number of 0s, all with odd runlength.
%H A383669 Robert Israel, <a href="/A383669/b383669.txt">Table of n, a(n) for n = 1..10000</a>
%e A383669 The binary representation 40 is 101000, so 40 is in the sequence.
%p A383669 with(priqueue):
%p A383669 R:= NULL: count:= 0:
%p A383669 q:= 1:
%p A383669 initialize(pq);
%p A383669 insert([-1],pq);
%p A383669 while count < 100 do
%p A383669   t:= op(extract(pq));
%p A383669   if t = -q then q:= 2*q+1
%p A383669   else R:= R,-t; count:= count+1;
%p A383669   fi;
%p A383669   insert([2*t-1],pq);
%p A383669   if t::odd then insert([2*t],pq)
%p A383669   else insert([4*t],pq)
%p A383669   fi;
%p A383669 od:
%p A383669 R; # _Robert Israel_, Jun 16 2025
%t A383669 Map[#[[1]] &, Cases[Map[{#, # =!= {} && Apply[And, OddQ[StringLength[#]]] &[StringCases[IntegerString[#, 2], "0" ..]]} &, Range[400]], {_, True}]] (* _Peter J. C. Moses_, Apr 23 2025 *)
%o A383669 (Python)
%o A383669 def ok(n): return n&(n+1) > 0 and all(run == '' or len(run) % 2 for run in bin(n)[2:].split('1'))
%o A383669 print([n for n in range(121) if ok(n)]) # _David Radcliffe_, Jun 16 2025
%Y A383669 Cf. A060142, A383668.
%K A383669 nonn,look,base
%O A383669 1,1
%A A383669 _Clark Kimberling_, May 15 2025