A382908 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 by their average index.
1, 2, 1, 3, 2, 3, 4, 1, 3, 2, 5, 2, 4, 3, 2, 4, 6, 3, 5, 1, 3, 7, 5, 6, 5, 2, 1
Offset: 1
Examples
The 1st pair (1,2,1) has average index 2 and encloses a(1) = 1 term. The 2nd pair (2,1,3,2) has average index 3.5 and encloses a(2) = 2 distinct terms. The 7th pair (4,1,3,2,5,2,4) has average index 10 and encloses a(7) = 4 distinct terms {1,2,3,5}. The 8th pair (2,5,2) has average index 11 and encloses a(8) = 1 term. Notice how the 2nd term of the 8th pair a(12) = 2 occurs earlier than the 2nd term of the 7th pair a(13) = 4. Because the average index (or center of the subsequence) is earlier in the case of the pair enclosing a(7) = 4 distinct terms, we consider it earlier than the pair enclosing a(8) = 1 term. If after setting a(12) = 2 enclosing a(8) = 1 term we had not been able to find a value to create a pair with an earlier average index to enclose a(7) = 4 distinct values, it would be necessary to backtrack to a(12) = 2 and try a different candidate.
Comments