A338804 A sequence containing each nonnegative integer exactly twice, such that for all k, k numbers appear in the sequence between the first and second appearances of k.
0, 0, 3, 1, 2, 1, 3, 2, 9, 10, 11, 12, 4, 5, 6, 7, 8, 4, 9, 5, 10, 6, 11, 7, 12, 8, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 13, 27, 14, 28, 15, 29, 16, 30, 17, 31, 18, 32, 19, 33, 20, 34, 21, 35, 22, 36, 23, 37, 24, 38, 25, 39, 26
Offset: 1
Examples
From the first and second appearances of 5 the sequence is 5, 6, 7, 8, 4, 9, 5 and as such has five numbers between the two 5's.
Comments