login
A363678
Start with the list of positive integers. For each m = 1, 2, 3, ..., insert a copy of the number m after each of the next m-1 terms.
0
1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 4, 6, 5, 6, 7, 6, 7, 5, 7, 6, 7, 8, 7, 8, 9, 8, 9, 7, 9, 8, 9, 10, 9, 10, 8, 10, 9, 10, 7, 10, 9, 10, 8, 10, 9, 10, 11, 10, 11, 9, 11, 10, 11, 8, 11, 12, 11, 12, 8, 12, 11, 12, 13, 12, 13, 11, 13, 12, 13, 14, 13, 14, 12, 14, 13, 14, 11, 14, 13, 14
OFFSET
1,2
EXAMPLE
We start with 1,2,3,4,5,6,7,8,9,10,... We repeat the 2, inserting the new copy after the 3, which gives 1,2,3,2,4,5,6,7,8,... Then we insert two additional copies of the 3 in the earliest non-consecutive locations after the first 3, which gives 1,2,3,2,3,4,3,5,6,7,8,... And so on.
PROG
(PARI) Axxx ( N = 99, a = List([1..N]), i = 1 ) = {
for( n = 1, N, for ( j = 1, n-1,
if ( i+2*j > #a+1, N = 0; break); list insert ( a, n, i + 2*j )
) ; until ( i > #a || a[i] > n, i++ ) ; N || break ); a[1..min(i+1, #a)]}/* \\ From M. F. Hasler via Seqfan, Jul 10 2023
CROSSREFS
Sequence in context: A100795 A045781 A045670 * A194960 A111439 A020986
KEYWORD
nonn
AUTHOR
Ali Sada, Jul 09 2023
STATUS
approved