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.

Showing 1-2 of 2 results.

A342264 Lexicographically earliest sequence of distinct nonnegative terms such that both a(n) and a(n) + a(n+1) have digits in nondecreasing order.

Original entry on oeis.org

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, 27, 28, 38, 39, 49, 66, 45, 34, 35, 44, 55, 56, 57, 58, 59, 67, 46, 68, 47, 69, 48, 77, 36, 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
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Mar 07 2021

Keywords

Comments

10 is obviously the first integer not present in the sequence as 1 > 0.

Examples

			a(10) = 9 and a(11) = 13 sum up to 22: the three numbers have digits in nondecreasing order;
a(11) = 13 and a(12) = 11 sum up to 24 (same property);
a(12) = 11 and a(13) = 12 sum up to 23 (same property);
etc.
		

Crossrefs

Cf. A009994 (numbers with digits in nondecreasing order), A342265 and A342266 (variations on the same idea).

Programs

  • Maple
    ND[1]:= [$1..9]:
    for d from 2 to 5 do
       ND[d]:= map(proc(t) local j; seq(10*t + j,j=(t mod 10) .. 9) end proc, ND[d-1])
    od:
    S:= [seq(op(ND[i]),i=1..5)]): nS:= nops(S):
    isnd:= proc(x) member(x,ND[ilog10(x)+1]) end proc:
    R:= 0: t:= 0:
    for count from 2 to 100 do
      found:= false;
      for i from 1 to nS do
        if isnd(t + S[i]) then
          R:= R, S[i];
          t:= S[i];
          S:= subsop(i=NULL, S);
          nS:= nS-1;
          found:= true;
          break
        fi;
      od;
      if not found then break fi;
    od:
    R; # Robert Israel, Jul 14 2025
  • Python
    def nondec(n): s = str(n); return s == "".join(sorted(s))
    def aupton(terms):
      alst = [0]
      for n in range(2, terms+1):
        an = 1
        while True:
          while an in alst: an += 1
          if nondec(an) and nondec(alst[-1]+an): alst.append(an); break
          else: an += 1
      return alst
    print(aupton(74)) # Michael S. Branicky, Mar 07 2021

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.

Original entry on oeis.org

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, 34, 78, 111, 333, 17, 19, 79, 29, 89, 25, 99, 199, 112, 444, 26, 28, 56, 35, 188, 113, 119, 556, 114, 999, 122, 1199, 888, 123, 4444, 36, 66, 124, 118, 222, 445, 115, 129, 67, 133, 667, 134, 68, 889, 223
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Mar 07 2021

Keywords

Comments

10 is obviously the first integer not present in the sequence as 1 > 0.
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

Examples

			Terms a(1) = 0 to a(5) = 5 sum up to 11: those six numbers have digits in nondecreasing order;
terms a(1) = 0 to a(6) = 4 sum up to 15: those seven numbers have digits in nondecreasing order;
terms a(1) = 0 to a(7) = 7 sum up to 22: those eight numbers have digits in nondecreasing order; etc.
		

Crossrefs

Cf. A009994 (numbers with digits in nondecreasing order), A342264 and A342266 (variations on the same idea).

Programs

  • Python
    def nondec(n): s = str(n); return s == "".join(sorted(s))
    def aupton(terms):
      alst = [0]
      for n in range(2, terms+1):
        an, cumsum = 1, sum(alst)
        while True:
          while an in alst: an += 1
          if nondec(an) and nondec(cumsum + an): alst.append(an); break
          else: an += 1
      return alst
    print(aupton(100)) # Michael S. Branicky, Mar 07 2021
Showing 1-2 of 2 results.