login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A363654 Lexicographically earliest sequence of positive integers such that the n-th pair of identical terms encloses exactly a(n) terms. 3
1, 2, 1, 3, 2, 3, 1, 2, 4, 3, 4, 5, 3, 6, 7, 4, 3, 8, 6, 9, 7, 8, 4, 10, 3, 7, 4, 6, 8, 9, 11, 10, 12, 3, 9, 13, 7, 3, 11, 9, 14, 15, 13, 16, 17, 7, 18, 3, 19, 20, 11, 14, 9, 20, 17, 15, 19, 20, 18, 21, 11, 22, 3, 23, 24, 25, 26, 14, 17, 9, 27, 28, 29, 15, 26, 19 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Pairs are numbered according to the position of the second term.
LINKS
EXAMPLE
a(1) = 1. The 1st constructed pair encloses 1 term: [1, 2, 1].
a(2) = 2. The 2nd constructed pair encloses 2 terms: [2, 1, 3, 2].
a(3) = 1. The 3rd constructed pair encloses 1 term: [3, 2, 3].
a(4) = 3. The 4th constructed pair encloses 3 terms: [1, 3, 2, 3, 1].
a(5) = 2. The 5th constructed pair encloses 2 terms: [2, 3, 1, 2].
a(6) = 3. The 6th constructed pair encloses 3 terms: [3, 1, 2, 4, 3].
a(7) = 1. The 7th constructed pair encloses 1 term: [4, 3, 4].
...
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
a, indexes = [1], {1: 0}
yield a[-1]
for i in count(0):
num = 1
while True:
if num in indexes:
if (len(a) - indexes[num]) == (a[i]+1):
an = num; indexes[an] = len(a); a.append(an); yield an
break
else:
num += 1
else:
an = max(a)+1; indexes[an] = len(a); a.append(an); yield an
num = 1
print(list(islice(agen(), 100))) # Gavin Lupo and Michael S. Branicky, Jun 13 2023
CROSSREFS
Sequence in context: A102853 A304099 A293390 * A189231 A107337 A066376
KEYWORD
nonn
AUTHOR
Eric Angelini and Gavin Lupo, Jun 13 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 5 16:56 EDT 2024. Contains 372276 sequences. (Running on oeis4.)