# [seqfan] Re: The Annoyance Sequence

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Sun Jul 16 20:09:54 CEST 2023

``` Ali's description makes sense to me. (Although FWIW I don't like the
"Annoying Sequence" name; it doesn't seem to convey anything useful about
the structure, and it's just... annoying?)
Here's a Python program that implements the idea (up to the 50th term):

def smartlyTruncatedList(x):

i = len(x)

while (x[i-1] == i):

i -= 1

return x[:i]

theList = list(range(1,10000))

for i in range(0, 50):

print('Before step %d, the list is: %r' % (i+1,
smartlyTruncatedList(theList)))

annoyingNumber = theList[i]

for d in range(0, annoyingNumber):

annoyedNumber = theList[i+1]

assert (i+2+annoyedNumber < len(theList))

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, smartlyTruncatedList(theList)))

And here's the program's output, which agrees with Ali's:

Before step 1, the list is: []

After 1 annoys 2, the list is: [1, 3, 4, 2]

Before step 2, the list is: [1, 3, 4, 2]

After 3 annoys 4, the list is: [1, 3, 2, 5, 6, 7, 4]

After 3 annoys 2, the list is: [1, 3, 5, 6, 2, 7, 4]

After 3 annoys 5, the list is: [1, 3, 6, 2, 7, 4, 8, 5]

Before step 3, the list is: [1, 3, 6, 2, 7, 4, 8, 5]

After 6 annoys 2, the list is: [1, 3, 6, 7, 4, 2, 8, 5]

After 6 annoys 7, the list is: [1, 3, 6, 4, 2, 8, 5, 9, 10, 11, 7]

After 6 annoys 4, the list is: [1, 3, 6, 2, 8, 5, 9, 4, 10, 11, 7]

After 6 annoys 2, the list is: [1, 3, 6, 8, 5, 2, 9, 4, 10, 11, 7]

After 6 annoys 8, the list is: [1, 3, 6, 5, 2, 9, 4, 10, 11, 7, 12, 8]

After 6 annoys 5, the list is: [1, 3, 6, 2, 9, 4, 10, 11, 5, 7, 12, 8]

Before step 4, the list is: [1, 3, 6, 2, 9, 4, 10, 11, 5, 7, 12, 8]

After 2 annoys 9, the list is: [1, 3, 6, 2, 4, 10, 11, 5, 7, 12, 8, 13,
14, 9]

After 2 annoys 4, the list is: [1, 3, 6, 2, 10, 11, 5, 7, 4, 12, 8, 13,
14, 9]

Before step 5, the list is: [1, 3, 6, 2, 10, 11, 5, 7, 4, 12, 8, 13, 14, 9]

[...]

After 116 annoys 52, the list is: [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, [...]

On Sun, Jul 16, 2023 at 1:38 PM Ali Sada via SeqFan <seqfan at list.seqfan.eu>
wrote:

>  Hi Alex and Yifan Xe,
> Thank you very much for your responses.
> Alex wrote  "I wonder if it's a permutation of the integers"
> I have seen similar comments on the OEIS regarding permutations of
> positive integers. TBH, I don't know why we need a proof in these cases.
> For example, in this sequence we started we the list of positive integers
> and the algorithm doesn't add or delete any numbers, so, the sequence
> should be a permutation of positive integers.

The question is whether any specific integer is unlucky enough to keep
getting bumped out of its position over and over and over *forever*.
For example, we see that the number "77" doesn't appear anywhere in the
first 50 terms of the sequence quoted above. Suppose "77" doesn't appear in
the first 200 terms (as indeed it doesn't). Suppose it doesn't appear in
the first *billion* terms. Suppose it *never* appears. If that's the case —
if it's the case that "77" *never* appears in the OEIS sequence — then the
OEIS sequence certainly can't be a permutation of the integers.

HTH,
Arthur
```