login
A175415
Those positive integers n that when written in binary, each run of 0's and 1's has a length which divides the number of binary digits of n.
2
1, 2, 3, 5, 7, 9, 10, 11, 12, 13, 15, 21, 31, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 63, 85, 127, 132, 133, 134, 144, 146, 147, 148, 149, 150, 153, 154, 155, 158, 161, 164, 165, 166, 169, 170, 171, 172
OFFSET
1,2
EXAMPLE
35 in binary is 100011. There is a run of one 1, followed by a run of three 0's, followed finally by a run of two 1's. And there are six binary digits all together. Since 1, 3, and 2 each divide 6, then 35 is in the sequence.
PROG
(Python)
from itertools import groupby
def ok(n):
b = bin(n)[2:]
return all(len(b)%len(list(g)) == 0 for k, g in groupby(b))
print([k for k in range(1, 173) if ok(k)]) # Michael S. Branicky, Nov 07 2022
CROSSREFS
Sequence in context: A089743 A080587 A342190 * A304721 A063464 A341518
KEYWORD
base,nonn
AUTHOR
Leroy Quet, May 07 2010
STATUS
approved