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.
%I A302173 #18 Feb 03 2025 13:54:43 %S A302173 0,1,2,3,4,5,6,7,8,9,78,67,56,45,34,23,12,31,20,120,123,42,312,342, %T A302173 345,64,53,423,453,456,75,645,675,678,97,86,756,786,789,7867,89,7897, %U A302173 867,564,534,231,201,234,567,897,8675,6453,4231,2012,3120,1201,2312,3123,1231,2342,3423,1234,2345 %N A302173 Lexicographically first sequence of distinct terms such that any set of three successive digits can be reordered as {d, d+1, d+2}, d being the smallest of the three digits. %C A302173 As the digit 0 has no predecessor and the digit 9 has no successor here, sets of successive digits like {1,0,9} and {8,9,0} are forbidden. %H A302173 Dominic McCarty, <a href="/A302173/b302173.txt">Table of n, a(n) for n = 1..10000</a> (first 624 terms from Jean-Marc Falcoz) %e A302173 Terms a(1) to a(10) are obvious; %e A302173 a(11) is 78 because 78 is the smallest integer not yet in the sequence such that the elements of the sets {8,9,7} and {9,7,8} are three consecutive digits; %e A302173 a(12) is 67 because 67 is the smallest integer not yet in the sequence such that the elements of the sets {7,8,6} and {8,6,7} are three consecutive digits; %e A302173 a(13) is 56 because 56 is the smallest integer not yet in the sequence such that the elements of the sets {6,7,5} and {7,5,6} are three consecutive digits; %e A302173 etc. %o A302173 (Python) %o A302173 a, runLength = [i for i in range(10)], 3 %o A302173 def helper(s,k,l,a): %o A302173 if k not in a: return k %o A302173 return min([helper(s[(2-l):]+str(i),int(str(k)+str(i)),l,a) for i in range(10) if (k!=0 or i!=0) and s.find(str(i))==-1 and (all(d[n]+1==d[n+1] for n in range(l-1)) if (d:=sorted([int((s+str(i))[n]) for n in range(l)])) else False)]) %o A302173 while len(a)<100: a.append(helper(("".join(map(str,a)))[(1-runLength):],0,runLength,a)) %o A302173 print(a) # _Dominic McCarty_, Feb 02 2025 %Y A302173 Cf. A228326 for the same idea with sets of two digits. %K A302173 nonn,base %O A302173 1,3 %A A302173 _Eric Angelini_ and _Jean-Marc Falcoz_, Apr 03 2018