login
A378949
Numbers with monotonically increasing digits, increasing by only 0 or 1.
1
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, 88, 89, 99, 111, 112, 122, 123, 222, 223, 233, 234, 333, 334, 344, 345, 444, 445, 455, 456, 555, 556, 566, 567, 666, 667, 677, 678, 777, 778, 788, 789, 888, 889, 899, 999
OFFSET
1,2
LINKS
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
Sequence in context: A193498 A361181 A239087 * A095227 A131366 A061487
KEYWORD
nonn,base
AUTHOR
Randy L. Ekl, Dec 18 2024
EXTENSIONS
Offset corrected by James C. McMahon, Dec 21 2024
STATUS
approved