OFFSET
1,2
EXAMPLE
32 is a term since it has monotonically decreasing digits whose difference is at most 1.
33 is a term since it also has monotonically decreasing digits whose difference is at most 1.
MATHEMATICA
Select[Range[999], SubsetQ[{0, 1}, -Differences[IntegerDigits[#]]] &] (* Stefano Spezia, Dec 08 2024 *)
PROG
(Python)
from itertools import count, islice
def bgen(last, d):
if d == 0: yield tuple(); return
t = (1, 9) if last == None else (max(0, last-1), last)
for i in range(t[0], t[1]+1): yield from ((i, )+r for r in bgen(i, d-1))
def agen(): # generator of terms
yield from (int("".join(map(str, i))) for d in count(1) for i in bgen(None, d))
print(list(islice(agen(), 62))) # Michael S. Branicky, Dec 08 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Randy L. Ekl, Dec 07 2024
STATUS
approved
