%I #10 Mar 07 2021 17:45:15
%S 0,1,2,3,4,5,6,7,8,9,13,11,12,14,15,18,16,17,19,25,22,23,24,33,26,29,
%T 27,28,38,39,49,66,45,34,35,44,55,56,57,58,59,67,46,68,47,69,48,77,36,
%U 78,37,79,88,89,99,123,111,112,113,114,115,118,116,117,119,125,122,124,133,126,129,127,128,138
%N Lexicographically earliest sequence of distinct nonnegative terms such that both a(n) and a(n) + a(n+1) have digits in nondecreasing order.
%C 10 is obviously the first integer not present in the sequence as 1 > 0.
%e a(10) = 9 and a(11) = 13 sum up to 22: the three numbers have digits in nondecreasing order;
%e a(11) = 13 and a(12) = 11 sum up to 24 (same property);
%e a(12) = 11 and a(13) = 12 sum up to 23 (same property); etc.
%o (Python)
%o def nondec(n): s = str(n); return s == "".join(sorted(s))
%o def aupton(terms):
%o alst = [0]
%o for n in range(2, terms+1):
%o an = 1
%o while True:
%o while an in alst: an += 1
%o if nondec(an) and nondec(alst[-1]+an): alst.append(an); break
%o else: an += 1
%o return alst
%o print(aupton(74)) # _Michael S. Branicky_, Mar 07 2021
%Y Cf. A009994 (numbers with digits in nondecreasing order), A342265 and A342266 (variations on the same idea).
%K base,nonn
%O 1,3
%A _Eric Angelini_ and _Carole Dubois_, Mar 07 2021
|