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.
%I A338804 #24 Jan 09 2021 02:10:51 %S A338804 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, %T A338804 30,31,32,33,34,35,36,37,38,39,13,14,15,16,17,18,19,20,21,22,23,24,25, %U A338804 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 %N 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. %C A338804 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). %C A338804 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. %e A338804 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. %Y A338804 Cf. A000244, A026272. %K A338804 nonn,easy %O A338804 1,3 %A A338804 _Elliott Line_, Nov 10 2020