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.

A302499 Lexicographically first sequence of distinct terms such that any set of four successive digits can be reordered as {d, d+1, d+2, d+3}, d being the smallest of the four digits.

This page as a plain text file.
%I A302499 #14 Feb 03 2025 21:24:04
%S A302499 0,1,2,3,4,5,6,7,8,9,67,85,674,56,34,52,341,23,41,230,12,30,123,45,63,
%T A302499 452,345,234,523,412,301,2301,2341,2345,634,563,456,74,567,89,678,96,
%U A302499 78,967,856,745,6345,6745,6785,6789,67856,785,67456,789,67896,7856,7456,3452,3412,3012,3456,7896
%N A302499 Lexicographically first sequence of distinct terms such that any set of four successive digits can be reordered as {d, d+1, d+2, d+3}, d being the smallest of the four digits.
%C A302499 As the digit 0 has no predecessor and the digit 9 has no successor here, sets of successive digits like {2,1,0,9} and {7,8,9,0} are forbidden.
%H A302499 Dominic McCarty, <a href="/A302499/b302499.txt">Table of n, a(n) for n = 1..10000</a> (first 269 terms from Jean-Marc Falcoz)
%e A302499 Terms a(1) to a(10) are obvious;
%e A302499 a(11) is 67 because 67 is the smallest integer not yet in the sequence such that the elements of the sets {7,8,9,6} and {8,9,6,7} are four consecutive digits;
%e A302499 a(12) is 85 because 85 is the smallest integer not yet in the sequence such that the elements of the sets {9,6,7,8} and {6,7,8,5} are four consecutive digits;
%e A302499 a(13) is 674 because 674 is the smallest integer not yet in the sequence such that the elements of the three sets {7,8,5,6}, {8,5,6,7} and {5,6,7,4} are four consecutive digits;
%e A302499 etc.
%o A302499 (Python)
%o A302499 a, runLength = [i for i in range(10)], 4
%o A302499 def helper(s, k, l, a):
%o A302499     if k not in a: return k
%o A302499     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 A302499 while len(a)<100: a.append(helper(("".join(map(str, a)))[(1-runLength):], 0, runLength, a))
%o A302499 print(a) # _Dominic McCarty_, Feb 03 2025
%Y A302499 Cf. A228326 for the same idea with sets of two digits and A302173 for sets of three digits.
%K A302499 nonn,base
%O A302499 1,3
%A A302499 _Eric Angelini_ and _Jean-Marc Falcoz_, Apr 09 2018