%I #19 May 14 2021 02:46:39
%S 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 37,38,39,40,41,42,48,49,51,52,56,57,58,60,62,63,64,65,67,69,70,71,75,
%U 76,78,79,80,81,83,84,96,97,99,101,102,103,104,105,106,112
%N Numbers whose base-2 digits have #(pits) = #(peaks); see Comments.
%C 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 Clark Kimberling, <a href="/A296858/b296858.txt">Table of n, a(n) for n = 1..10000</a>
%e 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 z = 200; b = 2;
%t d[n_] := Differences[Sign[Differences[IntegerDigits[n, b]]]];
%t Select[Range [z], Count[d[#], -2] == Count[d[#], 2] &] (* A296858 *)
%t Select[Range [z], Count[d[#], -2] < Count[d[#], 2] &] (* A296859 *)
%t Select[Range [z], Count[d[#], -2] > Count[d[#], 2] &] (* A296860 *)
%o (Python)
%o def cwo(subs, s): # count with overlaps allowed
%o c = i = 0
%o while i != -1:
%o i = s.find(subs, i)
%o if i != -1: c += 1; i += 1
%o return c
%o def ok(n): b = bin(n)[2:]; return cwo('101', b) == cwo('010', b)
%o print(list(filter(ok, range(1, 113)))) # _Michael S. Branicky_, May 11 2021
%Y Cf. A296882, A296712, A296859, A296860.
%K nonn,base,easy
%O 1,2
%A _Clark Kimberling_, Jan 08 2018