login
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, 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,3
COMMENTS
The sequence is constructed so that after the initial two 0's the next three pairs form a self-contained block beginning with 3, the subsequent nine pairs form a self-contained block beginning with 9, the following twenty-seven pairs form a block beginning with 27, etc. (powers of 3: A000244).
There are numerous sequences that satisfy the given criteria, so to fully define the continuation of this sequence I will add the following extra constraints. After the 0th block 0,0 the n-th block is found as follows: The block can be split into two halves such that one occurrence of each number appears in each half. The first half of the n-th block begins with 3^n then increases by consecutive integers until the maximum for that block: (3^(n+1) - 3)/2, before abruptly dropping to (3^n - 1)/2 and increasing by consecutive integers until (3^n - 1) is reached. The second half of the n-th block is then defined by the original constraints.
EXAMPLE
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.
CROSSREFS
Sequence in context: A035115 A370897 A146969 * A090270 A326441 A178830
KEYWORD
nonn,easy
AUTHOR
Elliott Line, Nov 10 2020
STATUS
approved