Tuesday, September 6, 2016

A method to visualize the underlying patterns of fractal sequences

As Wikipedia says, a fractal sequence is one that contains itself as a proper subsequence. An example is $\{1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, ...\}$ If the first occurrence of each n is deleted, the remaining sequence is identical to the original. The process can be repeated indefinitely, so that actually, the original sequence contains not only one copy of itself, but rather, infinitely many.

Trying to find ways of visualizing the underlying patterns, I managed to convert a sequence to an elementary cellular automaton in which the first status (or step) of the automaton corresponds with the initial sequence, and the next status is a sequence generated by a replacement rule in which the closest element to the right of an element that is marked to be removed (following the definition of the fractal sequence) will invade (or "phagocyte") that position with its value (the invader value will increase its visual size). Applying this rule repeatedly, the evolution of the status of the automaton in time is visualized, and a fractal pattern arises.

Besides, if each element of the sequence of each status represents a binary bit (marked to be removed = $0$, not marked to be removed = $1$), it is possible to obtain a representation of the original sequence in terms of an equivalent sequence obtained by a binary manipulation of the status. Below there is an example of the algorithm and the questions are at the end:

1. For instance the following fractal sequence, (OEIS A000265), when the first appearance of each odd integer is removed -$1,3,5,7,9..$.-, the resulting sequence is the same sequence than the original one:

$$\{1,1,3,1,5,3,7,1,9,5,11,3,13,7,15,1,17,9,19,5,21...\}$$

2. The following image shows the first status on the top, which is the initial sequence marking the elements that will be removed (the first $1$, first $3$, first $5$, etc. in blue color; and the second status below the first status: the elements marked in the first status were "invaded" (or "phagocyted") by the right side elements that are not removed in the former step, so those elements increased their size. And then again we mark the elements that will be removed (the first $1$, first $3$, first $5$, etc.:


3. Repeating the process we will arrive to a fractal pattern like this one (e.g. in 5 steps):


4. Now if we check the vertical values on each element of the status, we can create an unique sequence equivalent to the original fractal sequence. Starting with the most left side column and assuming that the first status (top) represents $2^0$, the second status represents $2^1$, and the color represents the value of the multiplying term (*0 if blue or *1 if not blue), we obtain the sequence:

$$\{0,1,2,3,4,5,6,7,8,9...\}$$

For instance the first column is $0 \cdot 2^0 + 0 \cdot 2^1 + 0 \cdot 2^2 ... = 0$, the second column is $1 \cdot 2^0 + 0 \cdot  2^1 + 0 \cdot 2^2 ... = 1$, etc.

So, by this method, the equivalent sequence of $\{1,1,3,1,5,3,7,1,9,5,11,3,13,7,15,1,17,9,19,5,21...\}$ is $\{1,2,3,4,5,6,7,8,9,10,11,12...\}$.

The equivalent sequence vary depending on the original fractal sequence, these are some examples (click to expand the image):


After thinking a little bit more about the options, this is a possible way of showing the underlying patterns: for the same example as above, OEIS A000265, each initial number of the sequence (or first status of the automaton) is represented by a radius $1$ circle (yellow).

In the second step, the elements marked to be removed were "invaded" by the closest elements at their right side. The invader element grew. We will show that growth by adding a new circle with a radius that covers both the invaded element (represented by its former step circle) and the invader (also represented by its former step circle).

That new circle is e.g. shown in red color. When we repeat the algorithm, or in other words, we continue evolving the automaton shown in the question some more steps, finally the pattern starts to arise:


I have asked at MSE if there are other methods to show the underlying patterns of the fractal sequences.