login
A364365
Start with the list of positive integers L = {1, 2, 3, ...} and set a(1) = 1. Then, for n = 1, 2, 3, ..., do the following: For each m in 1..a(n), move the number k = L(n+1) to the right by k steps. The number remaining immediately to the right of a(n) becomes a(n+1).
1
1, 3, 6, 2, 10, 9, 5, 8, 22, 4, 13, 15, 20, 29, 7, 12, 18, 32, 59, 50, 19, 31, 14, 81, 16, 90, 17, 25, 78, 83, 21, 46, 65, 23, 41, 71, 64, 36, 53, 47, 58, 44, 35, 76, 62, 43, 88, 49, 123, 116, 27, 111, 40, 11, 69, 30, 79, 102, 24, 60, 159, 73, 248, 72, 55, 185, 45, 101, 38, 95, 141
OFFSET
1,2
COMMENTS
This sequence was called the Annoyance sequence on a Seqfan thread.
LINKS
EXAMPLE
We start with the positive integers:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
Set a(1) = 1. The number immediately to its right, 2, is annoyed, and moves 2 steps away, so the numbers are now in the order
1, 3, 4, 2, 5, 6, 7, 8, 9, 10, ...
Then a(2) = 3, which annoys three numbers: 4 moves 4 steps, giving
1, 3, 2, 5, 6, 7, 4, 8, 9, 10, ...
after which 2 moves 2 steps, giving
1, 3, 5, 6, 2, 7, 4, 8, 9, 10, ...
and 5 moves 5 steps, giving
1, 3, 6, 2, 7, 4, 8, 5, 9, 10, ....
Now a(3) = 6, which annoys six numbers, and so on.
PROG
(Python)
N = 70
theList = [1, 2, 3, 4]
for i in range(N):
# print('Before step %d, the list is: %r' % (i+1, theList))
annoyingNumber = theList[i]
for d in range(0, annoyingNumber):
annoyedNumber = theList[i+1]
if (i+2+annoyedNumber >= len(theList)):
theList += [j for j in range(len(theList)+1, i+3+annoyedNumber)]
theList = theList[:i+1] + theList[i+2:i+2+annoyedNumber] + [annoyedNumber] + theList[i+2+annoyedNumber:]
# print(' After %d annoys %d, the list is: %r' % (annoyingNumber, annoyedNumber, theList))
print('%r' % theList[:N]) # Arthur O'Dwyer, Jul 24 2023
CROSSREFS
Sequence in context: A353989 A354087 A210187 * A210189 A257506 A210035
KEYWORD
nonn
AUTHOR
Ali Sada, Jul 20 2023
STATUS
approved