A296858 Numbers whose base-2 digits have #(pits) = #(peaks); see Comments.
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
Examples
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.
Links
- Clark Kimberling, Table of n, a(n) for n = 1..10000
Programs
-
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 *)
-
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
Comments