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.
1, 2, 1, 3, 1, 2, 4, 2, 3, 4, 2, 5, 1
Offset: 1
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.
Comments