login
A375559
L starts out as the list of positive integers; at the n-th iteration, a(n) is set to L(1); then L(1) is moved to its new position in L, in between the first two elements that it has never before been next to; repeat at the second step.
0
1, 2, 3, 1, 4, 2, 5, 3, 6, 1, 5, 7, 4, 6, 8, 2, 7, 9, 3, 8, 10, 1, 9, 11, 8, 5, 10, 12, 9, 4, 11, 13, 10, 2, 12, 6, 9, 14, 2, 11, 3, 13, 7, 10, 6, 11, 15, 3, 12, 14, 8, 13, 1, 12, 16, 13, 9, 15, 13, 5, 14, 1, 17, 10, 14, 16, 4, 15, 18, 16, 2, 15, 17, 19, 16, 11, 18, 7
OFFSET
1,2
COMMENTS
Terms and correct definition by Ruud H.G. van Tol via SeqFan.
This sequence was called The Bad Neighbors sequence on the SeqFan list.
In the beginning, we insert L(1) between L(n+1) and L(n+2), but after a few steps, that doesn't work anymore because L(1) finds closer places between new neighbors.
EXAMPLE
In a list of positive integers, no one wants to stay near their old neighbors. 1 doesn't want to stay near 2 anymore, so, it inserts itself between 3 and 4: 2, 3, 1, 4, 5, 6, 7, 8, ...
a(1) = 1
2 doesn't want to stay near 3 nor 1, so, it inserts itself between 4 and 5: 3, 1, 4, 2, 5, 6, 7, 8, ... .
a(2) = 2
3 doesn't want to stay near 2 nor 4 nor 1, so, it inserts itself between 5 and 6: 1, 4, 2, 5, 3, 6, 7, 8, ... .
a(3) = 3
Now, 1 doesn't want to stay near 2 nor 3 nor 4, so, it inserts itself between 7 and 8: 4, 2, 5, 3, 6, 7, 1, 8, ... .
a(4) = 1
And so on.
CROSSREFS
Sequence in context: A118276 A023123 A023131 * A356625 A026276 A152201
KEYWORD
nonn
AUTHOR
Ali Sada, Aug 19 2024
STATUS
approved