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.

A296858 Numbers whose base-2 digits have #(pits) = #(peaks); see Comments.

This page as a plain text file.
%I A296858 #19 May 14 2021 02:46:39
%S A296858 1,2,3,4,6,7,8,9,10,12,14,15,16,17,19,20,24,25,26,28,30,31,32,33,35,
%T A296858 37,38,39,40,41,42,48,49,51,52,56,57,58,60,62,63,64,65,67,69,70,71,75,
%U A296858 76,78,79,80,81,83,84,96,97,99,101,102,103,104,105,106,112
%N A296858 Numbers whose base-2 digits have #(pits) = #(peaks); see Comments.
%C A296858 A pit is an index i such that d(i-1) > d(i) < d(i+1); a peak is an index i such that d(i-1) < d(i) > d(i+1). The sequences A296858-A296860 partition the natural numbers. See the guides at A296882 and A296712.
%H A296858 Clark Kimberling, <a href="/A296858/b296858.txt">Table of n, a(n) for n = 1..10000</a>
%e A296858 The base-2 digits of 112 are 1,1,1,0,0,0,0; here #(pits) = 0 and #(peaks) = 0, so that 112 is in the sequence.
%t A296858 z = 200; b = 2;
%t A296858 d[n_] := Differences[Sign[Differences[IntegerDigits[n, b]]]];
%t A296858 Select[Range [z], Count[d[#], -2] == Count[d[#], 2] &]   (* A296858 *)
%t A296858 Select[Range [z], Count[d[#], -2] < Count[d[#], 2] &]    (* A296859 *)
%t A296858 Select[Range [z], Count[d[#], -2] > Count[d[#], 2] &]    (* A296860 *)
%o A296858 (Python)
%o A296858 def cwo(subs, s): # count with overlaps allowed
%o A296858   c = i = 0
%o A296858   while i != -1:
%o A296858     i = s.find(subs, i)
%o A296858     if i != -1: c += 1; i += 1
%o A296858   return c
%o A296858 def ok(n): b = bin(n)[2:]; return cwo('101', b) == cwo('010', b)
%o A296858 print(list(filter(ok, range(1, 113)))) # _Michael S. Branicky_, May 11 2021
%Y A296858 Cf. A296882, A296712, A296859, A296860.
%K A296858 nonn,base,easy
%O A296858 1,2
%A A296858 _Clark Kimberling_, Jan 08 2018