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.

A382911 Lexicographically earliest sequence of positive integers such that the n-th pair of consecutive equal values are separated by a(n) distinct terms, with pairs numbered according to the average index of the pair.

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 4, 2, 3, 4, 2, 5, 1
Offset: 1

Views

Author

Neal Gersh Tolunsky, Apr 08 2025

Keywords

Comments

If two pairs have the same midpoint, the pair enclosing a longer subsequence is considered first (in other words, the pair with the earlier first term and later second term).
Calculating terms may require backtracking, since pair numbers are not fixed until enough later terms either do or don't pair with earlier terms.

Examples

			The 1st pair (1,2,1) has average index 2 and encloses a(1) = 1 terms.
The 2nd pair (2,1,3,1,2) has average index 4 and encloses a(2) = 2 distinct terms.
The 4th pair (3,1,2,4,2,3) has average index 6.5 and encloses a(4) = 3 distinct terms.
The 5th pair (2,4,2) has average index 7 and encloses a(5) = 1 term.
Notice how the 2nd term of the 5th pair a(8) = 2 occurs earlier than the 2nd term of the 4th pair a(9) = 3. Because the average index (or center of the subsequence) is earlier in the case of the pair enclosing a(4) = 3 terms, we consider it earlier than the pair enclosing a(5) = 1 terms. If after setting a(8) = 2 enclosing a(5) = 1 terms we had not been able to find a value to create a pair with an earlier average index to enclose a(4) = 3 distinct values, it would be necessary to backtrack to a(8) = 2 and try a different candidate.
		

Crossrefs