# [seqfan] A list-prepending system designed to produce an interesting sequence

Christian Lawson-Perfect christianperfect at gmail.com
Wed May 16 11:06:09 CEST 2018

```I've been trying to come up with a sequence which shows 'punctuated
equilibrium': not much activity for a long time, interspersed with very
rare flurries of activity.

Here's an operation on lists of integers:
- Find the longest contiguous subsequence of repeated numbers. When there
are two subsequences of maximal length, pick the leftmost one. Let L be the
length of the subsequence and N the repeated number.
- If N>0, subtract 1 from each element of the subsequence.
- Prefix the list with L.

Starting with [1] and repeatedly applying this operation, you get:

[1]
[1, 0]
[1, 0, 0]
[2, 1, 0, 0]
[2, 2, 1, 0, 0]
[2, 1, 1, 1, 0, 0]
[3, 2, 0, 0, 0, 0, 0]
[5, 3, 2, 0, 0, 0, 0, 0]
[5, 5, 3, 2, 0, 0, 0, 0, 0]
[5, 5, 5, 3, 2, 0, 0, 0, 0, 0]
[5, 5, 5, 5, 3, 2, 0, 0, 0, 0, 0]
[5, 5, 5, 5, 5, 3, 2, 0, 0, 0, 0, 0]
[5, 4, 4, 4, 4, 4, 3, 2, 0, 0, 0, 0, 0]
[5, 5, 3, 3, 3, 3, 3, 3, 2, 0, 0, 0, 0, 0]
[6, 5, 5, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0]
[7, 6, 5, 5, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]
[7, 7, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[12, 7, 7, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
...

You can look at the sequence formed by taking the leading element at each
iteration:

1, 1, 1, 2, 2, 2, 3, 5, 5, 5, 5, 5, 5, 5, 6, 7, 7, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, ...

And then look at the lengths of runs in that sequence:

3, 3, 1, 7, 1, 2, 17, 1, 1, 5, 41, 2, 1, 2, 12, 99, 5, 1, 1, 5, 29, 239,
12, 2, 1, 2, 12, 70, 423

That has the pleasing up-and-down-y quality I was looking for. I haven't
given this much thought beyond computing the terms I've given using some
very naive code. It's clear that the sequence of leading digits is
monotonic, and the first few iterations of the operation are enough to get
an idea of how the sudden jumps occur. I'm interested to see what other
structure there is, but I'm a bear of little brain.

Neither of the sequences I gave are in the OEIS, but I'm not sure what
names to give them. Would it be easiest to publish this online somewhere,
and refer to that?

```