login
A296858
Numbers whose base-2 digits have #(pits) = #(peaks); see Comments.
4
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, 37, 38, 39, 40, 41, 42, 48, 49, 51, 52, 56, 57, 58, 60, 62, 63, 64, 65, 67, 69, 70, 71, 75, 76, 78, 79, 80, 81, 83, 84, 96, 97, 99, 101, 102, 103, 104, 105, 106, 112
OFFSET
1,2
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 112 are 1,1,1,0,0,0,0; here #(pits) = 0 and #(peaks) = 0, so that 112 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, 113)))) # Michael S. Branicky, May 11 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Clark Kimberling, Jan 08 2018
STATUS
approved