OFFSET
0,3
COMMENTS
LINKS
FORMULA
Regular expression: 0|11*(0111*)*(0|01|011*)?.
MATHEMATICA
q[n_] := SequenceCount[IntegerDigits[n, 2], #] & /@ {{0, 0}, {0, 1, 0}} == {0, 0}; bin[n_] := FromDigits[IntegerDigits[n, 2]]; bin /@ Select[Range[0, 120], q] (* Amiram Eldar, Jan 27 2022 *)
PROG
(Python) # first method (as from definition)
def A101(n):
f0, f1, f2, r = 1, 1, 1, 0
while n > 0:
if n%2 == 1:
r = r+f0
n, f0, f1, f2 = n//2, f0+f2, f0, f1
return r
n, a = 0, 0
while n < 36:
if A101(a) == n:
print(bin(a)[2:], end = ", ")
n += 1
a += 1
(Python) # second method (as from regular expression)
def test(n):
s, i, n1 = bin(n)[2:], 0, 2
while i < len(s):
if s[i] == "0":
if n1 < 2:
return 0
n1 = 0
else:
n1 += 1
i += 1
return 1
n, a = 0, 0
while n < 36:
if test(a):
print(bin(a)[2:], end = ", ")
n += 1
a += 1
CROSSREFS
KEYWORD
nonn,base
AUTHOR
A.H.M. Smeets, Dec 24 2021
STATUS
approved