A348111 Numbers k whose binary expansion starts with the concatenation of the binary expansions of the run lengths in binary expansion of k.
0, 1, 7, 14, 28, 112, 127, 254, 509, 1016, 1018, 1792, 2033, 2037, 2039, 4066, 4072, 4075, 4078, 8132, 8135, 8150, 8156, 16256, 16300, 16313, 32513, 32528, 32576, 32601, 32607, 32626, 32639, 32767, 65027, 65087, 65153, 65202, 65248, 65253, 65255, 65534, 130307
Offset: 1
Examples
Regarding 32607: - the binary expansion of 32607 is "111111101011111", - the corresponding run lengths are: 7, 1, 1, 1, 5, - in binary: "111", "1", "1", "1", "101", - after concatenation: "111111101", - as "111111101011111" starts with "111111101", 32607 belongs to this sequence.
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Rémy Sigrist, PARI program for A348111
Programs
-
PARI
See Links section.
-
Python
from itertools import groupby def ok(n): if n == 0: return True b = bin(n)[2:] c = "".join(bin(len(list(g)))[2:] for k, g in groupby(b)) return b.startswith(c) print(list(filter(ok, range(2**17)))) # Michael S. Branicky, Oct 02 2021
Comments