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.

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

This page as a plain text file.
%I A302500 #11 Feb 03 2025 21:24:12
%S A302500 0,1,2,3,4,5,6,7,8,9,56,78,45,67,34,562,345,12,340,123,40,1234,51,23,
%T A302500 401,234,512,3401,2340,12340,12345,62,3451,2345,623,451,23401,23451,
%U A302500 23456,73,456,734,567,84,5673,4562,3456,784,5678,95,678,956,789,56784,56734,5623,4512,34012,34512,34562,34567,89
%N A302500 Lexicographically first sequence of distinct terms such that any set of five successive digits can be reordered as {d, d+1, d+2, d+3, d+4}, d being the smallest of the five digits.
%C A302500 As the digit 0 has no predecessor and the digit 9 has no successor here, sets of successive digits like {3,2,1,0,9} and {6,7,8,9,0} are forbidden.
%H A302500 Dominic McCarty, <a href="/A302500/b302500.txt">Table of n, a(n) for n = 1..10000</a> (first 257 terms from Jean-Marc Falcoz)
%e A302500 Terms a(1) to a(10) are obvious;
%e A302500 a(11) is 56 because 56 is the smallest integer not yet in the sequence such that the elements of the sets {6,7,8,9,5} and {7,8,9,5,6} are five consecutive digits;
%e A302500 a(12) is 78 because 78 is the smallest integer not yet in the sequence such that the elements of the sets {8,9,5,6,7} and {9,5,6,7,8} are five consecutive digits;
%e A302500 a(13) is 45 because 45 is the smallest integer not yet in the sequence such that the elements of the sets {5,6,7,8,4} and {6,7,8,4,5} are five consecutive digits;
%e A302500 etc.
%o A302500 (Python)
%o A302500 a, runLength = [i for i in range(10)], 5
%o A302500 def helper(s, k, l, a):
%o A302500     if k not in a: return k
%o A302500     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 A302500 while len(a)<100: a.append(helper(("".join(map(str, a)))[(1-runLength):], 0, runLength, a))
%o A302500 print(a) # _Dominic McCarty_, Feb 03 2025
%Y A302500 Cf. A228326 for the same idea with sets of two digits, A302173 for sets of three digits and A302499 for sets of four digits.
%K A302500 nonn,base
%O A302500 1,3
%A A302500 _Eric Angelini_ and _Jean-Marc Falcoz_, Apr 09 2018