OFFSET
1,2
COMMENTS
Essentially the same as A126684. - R. J. Mathar, Jun 15 2008
A126684 is the primary entry for this sequence. - Franklin T. Adams-Watters, Aug 30 2014
MATHEMATICA
Join[{1}, Select[Range[0, 600], Union[Take[IntegerDigits[#, 2], {2, -1, 2}]]=={0}&]] (* Harvey P. Dale, Sep 17 2023 *)
PROG
(Python)
from gmpy2 import digits
def A032937(n):
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def g(x):
s = digits(x, 4)
for i in range(l:=len(s)):
if s[i]>'1':
break
else:
return int(s, 2)
return int(s[:i]+'1'*(l-i), 2)
def f(x): return n+x-g(x)-g(x>>1)
return bisection(f, n, n) # Chai Wah Wu, Oct 29 2024
CROSSREFS
KEYWORD
nonn,base,changed
AUTHOR
STATUS
approved