OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
33 is a term since the digits are monotonically increasing and their difference is 0.
34 is also a term since the digits are monotonically increasing and their difference is 1.
35 is not a term since the difference in consecutive digits is not 0 or 1.
32 is not a term since the digits are decreasing.
MAPLE
extend:= proc(k) local m, d;
m:= 10^ilog10(k);
d:= floor(k/m);
if d = 1 then 10*m+k else (d-1)*10*m+k, d*10*m+k fi
end proc:
R:= $1..9:
A:= [R]:
for i from 2 to 5 do
A:= map(extend, A);
R:= R, op(sort(A));
od:
R; # Robert Israel, Jan 18 2025
MATHEMATICA
Select[Range[1000], SubsetQ[{0, 1}, Union@ Differences@ IntegerDigits[#]] &] (* James C. McMahon, Dec 21 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 (last, min(last+1, 9))
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 18 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Randy L. Ekl, Dec 18 2024
EXTENSIONS
Offset corrected by James C. McMahon, Dec 21 2024
STATUS
approved