OFFSET
1,1
LINKS
Peter Kagey, Run lengths of bits and run lengths of an auxiliary sequence, Mathematics Stack Exchange.
EXAMPLE
In binary, A308092 is 1, 10, 11, 111, 1110, 11100, 111000, 1110000, .... The sequence begins with a(1) = 2 ones followed by a(2) = 1 zeros, a(3) = 8 ones, a(4) = 1 zeros, a(5) = 3 ones, a(6) = 2 zeros, and so on.
This sequence first disagrees with A342937 at n = 51, where a(51) = 1 and
A342937(51) = 2.
PROG
(Python)
from itertools import groupby
def aupton(terms):
A308092, bstr, rl_lst, rl_idx, n = [1, 2], "110", [2], 2, 3
while len(rl_lst) < terms:
an = int(bstr[:n], 2) - int(bstr[:n-1], 2)
new_runs = [len(list(g)) for k, g in groupby(bstr[rl_idx:])]
if len(new_runs) > 1:
rl_idx += sum(new_runs[:-1])
rl_lst.extend(new_runs[:-1]) # don't take last one in case mid-run
return rl_lst[:terms]
print(aupton(86)) # Michael S. Branicky, Apr 03 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Peter Kagey, Mar 31 2021
STATUS
approved