cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A342265 Lexicographically earliest sequence of distinct nonnegative terms such that both a(n) and the cumulative sum a(1)+a(2)+...+a(n) have digits in nondecreasing order.

This page as a plain text file.
%I A342265 #14 Feb 05 2024 18:07:37
%S A342265 0,1,2,3,5,4,7,6,8,9,11,12,44,13,14,16,22,45,15,18,23,55,24,88,33,77,
%T A342265 34,78,111,333,17,19,79,29,89,25,99,199,112,444,26,28,56,35,188,113,
%U A342265 119,556,114,999,122,1199,888,123,4444,36,66,124,118,222,445,115,129,67,133,667,134,68,889,223
%N A342265 Lexicographically earliest sequence of distinct nonnegative terms such that both a(n) and the cumulative sum a(1)+a(2)+...+a(n) have digits in nondecreasing order.
%C A342265 10 is obviously the first integer not present in the sequence as 1 > 0.
%C A342265 The last term is a(173) = 122222, at which point the cumulative sum is 12467999, and the sequence cannot be extended. - _Michael S. Branicky_, Feb 05 2024
%H A342265 Michael S. Branicky, <a href="/A342265/b342265.txt">Table of n, a(n) for n = 1..173</a>
%e A342265 Terms a(1) = 0 to a(5) = 5 sum up to 11: those six numbers have digits in nondecreasing order;
%e A342265 terms a(1) = 0 to a(6) = 4 sum up to 15: those seven numbers have digits in nondecreasing order;
%e A342265 terms a(1) = 0 to a(7) = 7 sum up to 22: those eight numbers have digits in nondecreasing order; etc.
%o A342265 (Python)
%o A342265 def nondec(n): s = str(n); return s == "".join(sorted(s))
%o A342265 def aupton(terms):
%o A342265   alst = [0]
%o A342265   for n in range(2, terms+1):
%o A342265     an, cumsum = 1, sum(alst)
%o A342265     while True:
%o A342265       while an in alst: an += 1
%o A342265       if nondec(an) and nondec(cumsum + an): alst.append(an); break
%o A342265       else: an += 1
%o A342265   return alst
%o A342265 print(aupton(100)) # _Michael S. Branicky_, Mar 07 2021
%Y A342265 Cf. A009994 (numbers with digits in nondecreasing order), A342264 and A342266 (variations on the same idea).
%K A342265 base,nonn,fini,full
%O A342265 1,3
%A A342265 _Eric Angelini_ and _Carole Dubois_, Mar 07 2021