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.

A366493 Lexicographically earliest sequence such that each subsequence enclosed by two equal terms is distinct.

This page as a plain text file.
%I A366493 #20 Dec 07 2024 02:03:04
%S A366493 1,1,2,1,2,2,1,3,1,2,3,1,2,4,1,2,3,2,1,3,2,1,4,1,2,3,3,1,2,4,2,1,3,4,
%T A366493 1,2,3,4,1,2,4,3,1,2,4,3,2,1,4,2,1,3,5,1,2,3,4,2,1,3,5,2,1,3,4,2,1,4,
%U A366493 3,1,2,5,1,2,3,4,3,1,2,5,2,1,3,4,4,1,2,3,5,1,2,4,3,4,1,2,5,3,1,2,4,5,1,2,3,4,5,1,2,3,5
%N A366493 Lexicographically earliest sequence such that each subsequence enclosed by two equal terms is distinct.
%C A366493 A new value is always followed by 1.
%H A366493 Samuel Harkness, <a href="/A366493/b366493.txt">Table of n, a(n) for n = 1..10000</a>
%H A366493 Samuel Harkness, <a href="/A366493/a366493.m.txt">MATLAB program</a>
%e A366493 a(2)=1 because the subsequence (1,1) has not occurred before.
%e A366493 a(8)=3 because every smaller number would form a subsequence that has occurred already. a(8) cannot be 1 because this would make the subsequence (1,1), which was seen before at i=1,2. a(8) cannot be 2 because then we would have the subsequence (2,1,2) for a second time (first at i=3-5): 1,1,2,1,2,2,1,2
%o A366493 (MATLAB) See Links section.
%o A366493 (Python)
%o A366493 from itertools import islice
%o A366493 def agen(): # generator of terms
%o A366493     m, a = set(), []
%o A366493     while True:
%o A366493         an, allnew = 0, False
%o A366493         while not allnew:
%o A366493             allnew, an, mn = True, an+1, set()
%o A366493             for i in range(len(a)):
%o A366493                 if an == a[i]:
%o A366493                     t = tuple(a[i:]+[an])
%o A366493                     if t in m or t in mn: allnew = False; break
%o A366493                     mn.add(t)
%o A366493         yield an; a.append(an); m |= mn
%o A366493 print(list(islice(agen(), 111))) # _Michael S. Branicky_, Dec 06 2024
%Y A366493 Cf. A330896.
%K A366493 nonn,easy
%O A366493 1,3
%A A366493 _Neal Gersh Tolunsky_, Oct 10 2023