OFFSET
1,2
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 1..10000
PROG
(Python)
from itertools import count, islice
def A367626_gen(): # generator of terms
a = 0
yield 1
for n in count(1):
s = bin(n)[2:]
c, l = 2, len(s)
for i in range(1, l+1):
if (c:=c+(2 if s[l-i]=='1' else 0)) <= i:
break
else:
yield n-a<<1
a = n
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 25 2023
STATUS
approved