Hi everyone,
Hope all is well.
Start with the list of positive integers
1, 2, 3, 4, 5, 6, ...
At each step, scan the list from left to right and choose the first entry k such that removing k and reinserting it exactly k positions to the right places it immediately before a prime number. Perform the move and let a(n) be the value moved at the n-th step.
Initially, 1 moves one position to the right and lands immediately before 3, so a(1) = 1.
The list is now
2, 1, 3, 4, 5, 6, 7, ...
Neither 2 nor 1 qualifies, but 3 moves three positions to the right and lands immediately before 7, so a(2) = 3.
The sequence begins
1, 3, 2, 1, 4, 1, 6, 6, 6, 8, ...
We can use the same algorithm with other prescribed targets, for example triangular numbers.
Again, at each step choose the leftmost entry k that can be moved exactly k positions to the right so that it lands immediately before a triangular number.
The sequence begins
1, 7, 4, 8, 11, 18, 7, 19, 10, 6, ...
Question: Does every positive integer eventually appear in either sequence?
If any of these sequences is suitable for the OEIS I would really appreciate the usual help with the definition, terms, program, etc.
Best,
Ali