login
A296860
Numbers k whose base-2 digits d(m), d(m-1), ..., d(0) have #(pits) < #(peaks); see Comments.
4
18, 34, 36, 50, 66, 68, 72, 73, 74, 82, 98, 100, 114, 130, 132, 136, 137, 138, 144, 145, 146, 147, 148, 162, 164, 194, 196, 200, 201, 202, 210, 226, 228, 242, 258, 260, 264, 265, 266, 272, 273, 274, 275, 276, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297
OFFSET
1,1
COMMENTS
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.
LINKS
EXAMPLE
The base-2 digits of 297 are 1, 0, 0, 1, 0, 1, 0, 0, 1; here #(pits) = 1 and #(peaks) = 2, so 297 is in the sequence.
MATHEMATICA
z = 200; b = 2;
d[n_] := Differences[Sign[Differences[IntegerDigits[n, b]]]];
Select[Range [z], Count[d[#], -2] == Count[d[#], 2] &] (* A296858 *)
Select[Range [z], Count[d[#], -2] < Count[d[#], 2] &] (* A296859 *)
Select[Range [z], Count[d[#], -2] > Count[d[#], 2] &] (* A296860 *)
PROG
(Python)
def cwo(subs, s): # count with overlaps allowed
c = i = 0
while i != -1:
i = s.find(subs, i)
if i != -1: c += 1; i += 1
return c
def ok(n): b = bin(n)[2:]; return cwo('101', b) < cwo('010', b)
print(list(filter(ok, range(1, 298)))) # Michael S. Branicky, May 11 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Clark Kimberling, Jan 09 2018
STATUS
approved