Finding a pattern in a Numeric sequence

61 Views Asked by At

The following script generates a vector of integers and plots its items (index vs value).

import matplotlib.pyplot as plt
num_list = [0, 1]; n = 262000;
for i in range(1, n): num_list.append(num_list[i]); num_list.append(num_list[i]+num_list[i+1]);
plt.plot(range(2*n), num_list, "ko", markersize=1); plt.xscale('log'); plt.yscale('log');
plt.show()

Starting with the vector [0, 1] and i=1, we append the $i^{th}$ value to the vector, then append the sum of that item and its successor. Shortly, a pattern emerges:

[0, 1] -> [0, 1, 1, 2] -> [0, 1, 1, 2, 1, 3] -> ... -> [0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1]

Notice that the number $1$ (and every other number) appears in positions that are increasing powers of two starting from its previous occurrence. Here is the respective plot (with decimal logarithm axes):

Relevant code

Relevant plot


My question is: why does this sequence exhibits a fractal-like behavior? Why does the occurrence frequency decreases geometrically for every number? Any insight about its properties will surely be appreciated.