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.

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

This page as a plain text file.
%I A342264 #19 Jul 16 2025 16:49:49
%S A342264 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 A342264 27,28,38,39,49,66,45,34,35,44,55,56,57,58,59,67,46,68,47,69,48,77,36,
%U A342264 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 A342264 Lexicographically earliest sequence of distinct nonnegative terms such that both a(n) and a(n) + a(n+1) have digits in nondecreasing order.
%C A342264 10 is obviously the first integer not present in the sequence as 1 > 0.
%H A342264 Robert Israel, <a href="/A342264/b342264.txt">Table of n, a(n) for n = 1..4000</a>
%e A342264 a(10) = 9 and a(11) = 13 sum up to 22: the three numbers have digits in nondecreasing order;
%e A342264 a(11) = 13 and a(12) = 11 sum up to 24 (same property);
%e A342264 a(12) = 11 and a(13) = 12 sum up to 23 (same property);
%e A342264 etc.
%p A342264 ND[1]:= [$1..9]:
%p A342264 for d from 2 to 5 do
%p A342264    ND[d]:= map(proc(t) local j; seq(10*t + j,j=(t mod 10) .. 9) end proc, ND[d-1])
%p A342264 od:
%p A342264 S:= [seq(op(ND[i]),i=1..5)]): nS:= nops(S):
%p A342264 isnd:= proc(x) member(x,ND[ilog10(x)+1]) end proc:
%p A342264 R:= 0: t:= 0:
%p A342264 for count from 2 to 100 do
%p A342264   found:= false;
%p A342264   for i from 1 to nS do
%p A342264     if isnd(t + S[i]) then
%p A342264       R:= R, S[i];
%p A342264       t:= S[i];
%p A342264       S:= subsop(i=NULL, S);
%p A342264       nS:= nS-1;
%p A342264       found:= true;
%p A342264       break
%p A342264     fi;
%p A342264   od;
%p A342264   if not found then break fi;
%p A342264 od:
%p A342264 R; # _Robert Israel_, Jul 14 2025
%o A342264 (Python)
%o A342264 def nondec(n): s = str(n); return s == "".join(sorted(s))
%o A342264 def aupton(terms):
%o A342264   alst = [0]
%o A342264   for n in range(2, terms+1):
%o A342264     an = 1
%o A342264     while True:
%o A342264       while an in alst: an += 1
%o A342264       if nondec(an) and nondec(alst[-1]+an): alst.append(an); break
%o A342264       else: an += 1
%o A342264   return alst
%o A342264 print(aupton(74)) # _Michael S. Branicky_, Mar 07 2021
%Y A342264 Cf. A009994 (numbers with digits in nondecreasing order), A342265 and A342266 (variations on the same idea).
%K A342264 nonn,look,base
%O A342264 1,3
%A A342264 _Eric Angelini_ and _Carole Dubois_, Mar 07 2021