## Some novel observations concerning quadratic roots and fractal sequences

Disclaimer: To our knowledge we have not found the material presented here laid out here presented in completeness elsewhere. However, we should state that we do not follow the mathematical literature as a professional and could have missed stuff.

Introduction
$\sqrt{2}$ has captivated human imagination for a long time. Perhaps, its earliest mention is seen in the tradition of the Yajurveda, which provides an approximation for the number in the form of the convergent $\tfrac{577}{408}$ for construction of diagonals of squares in the vedi (altar) for the soma ritual. Yet, it has secrets that continue to reveal themselves over the ages. Here, we shall describe one such, which we stumbled upon in course of our study of sequences inspired by Nārāyaṇa paṇḍita, Douglas Hofstadter and Stephen Wolfram’s work.

A fractional number $h$ lends itself to an interesting operation (the floor-difference sequence; we had earlier described it here; an operation studied by Wolfram),
$f_0[n]=\lfloor (n+1) \cdot h \rfloor -\lfloor n\cdot h \rfloor$
Here the integer sequence $f_0[n]$ is defined by performing the above operation. If we use $h=\sqrt{2}$ results in the sequence,
1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1…
This pattern of 1 and 2 is not periodic. Nevertheless, it has defined pattern. Wolfram showed that it can be produced by a substitution system entirely independently of $\sqrt{2}$, namely,
$1 \rightarrow 1,2$ and $2 \rightarrow 1,2,1$
Notably, the ratio of the number of 1s to 2s in the string produced by the floor-difference operation (or equivalently the substitution system) converges to $\sqrt{2}$. Thus, the numbers of 1s and 2s in the sequence $f_0$ generated by the above process results in convergents that are like the partial sums of the continued fraction expression of $\sqrt{2}$,

$\sqrt{2}= 1+\cfrac{1}{2+\cfrac{1}{2+\cfrac{1}{2+\cfrac{1}{2+\dots}}}}$

Thus, in $f_0[1:70]$, the number of 1s is 41 and the number of 2s is 29. This gives us a convergent for $\sqrt{2}$ as $\tfrac{41}{29}=1.413793$ which is the 4th partial sum of the above continued fraction.

Case-1: Summation sequences defined on the floor-difference operation

Next we define a second integer sequence $f_1$ based $f_0$ thus,
$f_1[n]=\displaystyle \sum_{k=1}^n f_0[k]==1$,

i.e. we take the sum of all 1s present till position $n$ in sequence $f_0$. Thus, for the above 20 terms of $f_0$ the corresponding terms of $f_1$ are,
1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12…
The basic idea for this procedure is inspired by Hofstadter sequences and the process to generate the tiling fractals described by Rauzy. We notice right away that the value of $f_1[n]$ increases with $n$ in a step-wise fashion along a linear growth line. But what is the constant of this linear growth?

We can derive this thus: Let $x$ be the number of 1s and $y$ be the number of 2s in a sub-sequence of $f_0$ of length $n$. From above we know that the ratio $\lim_{n \to \infty} \tfrac{x}{y}=\sqrt{2}$. Hence, we may write,
$y=\dfrac{x}{\sqrt{2}}\\ x+y=n \; \therefore x + \dfrac{x}{\sqrt{2}} =n\\ x=\dfrac{n\sqrt{2}}{1+\sqrt{2}} =(2-\sqrt{2})n$

With this constant $2-\sqrt{2}$, we can now “rectify” the sequence $f_1$ i.e. remove its linear growth by straightening it along the x-axis and capture only its true oscillatory variation along the y-axis (see this earlier account for this). Thus, we get the rectified sequence,
$f_2[n]=f_1[n]-(2-\sqrt{2})n$
Figure 2 shows the first 500 terms of this sequence.

Figure 1

We observe that while $f_2$ takes a wide-range of positive and negative values they are all contained within a fixed bandwidth of 1. However, the values of $f_2$ are not symmetrically distributed about 0. The highest positive value is $2-\sqrt{2}$ and the lowest negative value is $1-\sqrt{2}$.

We next perform a serial summation operation on $f_2$ along the sequence. Given the above asymmetry in $f_2$ with respect to negative and positive value take by it, we again get a sequence oscillating about a linear growth line. This time we can rectify by taking the midpoint of the bandwidth of $f_2$, i.e.,
$\textrm{Midpoint}(2-\sqrt{2}, 1-\sqrt{2})=\dfrac{3-2\sqrt{2}}{2}$

Thus, we defined the rectified sequence $f_3$ as:
$f_3[n]=\displaystyle \sum_{k=1}^n f_2[k]-n \left( \dfrac{3-2\sqrt{2}}{2} \right)$

Figure 2 shows a plot of $f_3[1:n]$ up to different values of $n$. Figure 3 shows the same for a large cycle, $n=33435$ (see below).

Figure 2

Figure 3

We see that $f_3$ has an intricate fractal structure resembling rising gopura-s around a central shrine. A closer examination reveals that the fractal structure of $f_3$ has cycles of increasing lengths, i.e. the same structure re-occurs with greater intricacy at the cycle of the next length (Figure 2, 3). We determined that the lengths of the cycles centered on the highest successive values of $f_3$ are 27, 167, 983, 5739, 33435… This led us to establish that ratio of successive cycle lengths converges to $3+2 \sqrt{2}$. This number is the larger root of the quadratic equation $x^2-6x+1=0$.

We can do the same thing with the Golden Ratio $\phi$ which has the continued fraction expression,
$\phi= 1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\dots}}}}$

In this case, the sequence $f_0$ can be generated by the well-known substitution rule,
$1 \rightarrow 2; \; 2 \rightarrow 2,1$
Here the ratio of 2s to 1s in $f_0$ converges to $\phi$. We can likewise construct $f_1$ by counting the number of 2s as we walk along $f_0$ up to a given $n$. As with $\sqrt{2}$, we can rectify $f_1$ to get $f_2[n]=f_1[n]-n(\tfrac{1}{\phi})$. Here again, the bandwidth of $f_2$ is 1 but the values it takes are asymmetrically distributed about 0 with a maximum of $\phi-1$ and minimum of $\phi-2$. This gives us the rectification to obtain $f_3$ for $\phi$,
$f_3[n]=\displaystyle \sum_{k=1}^n f_2[k]-n \left( \dfrac{2\phi-3}{2} \right)$

Figure 4 shows the fractal structure of $f_3$ for $\phi$ comparable to that which we obtained for $\sqrt{2}$

Figure 4

We then established that the fractal cycles for $f_3$ of $\phi$ are of lengths: 32, 87, 231, 608, 1595, 4179, 10944… when defined on the basis of the successive highest values attained by $f_3$. Thus, the ratio of successive cycle lengths converges to $1+\phi$ in the case of the Golden Ratio fractal. $1+\phi$ is the root of the quadratic equation $x^2-3x+1=0$. This shows a similarity to the above convergent of the cycles of the $\sqrt{2}$ fractal. Further, while that convergent can be expressed as $\left (1+\sqrt{2} \right )^2$, this one for the Golden Ratio can be similarly expressed as $\left (1+\tfrac{1}{\phi} \right)^2$

This leads to the conjecture that all such fractals generated from floor-difference-derived sequences of quadratic roots have as convergents such roots of quadratic equations with a relationship like the above ones to the original root.

Figure 5

There are some notable features of the distribution of the values of $f_3$:
1) The number of values $>0$ is always more than those $<0$ for a given fractal cycle. This markedly more for the $f_3$ of $\sqrt{2}$ as opposed to that of $\phi$.
2) The distribution of the values taken by $f_3$ is approximately normal (Figure 5; shown for $f_3$ of $\sqrt{2}$).
3) Most notably, the $f_3$ fractal displays structures with quasi-mirror symmetry (figure 2, 3, 4), when we consider the distribution of values around given central points. For the $\sqrt{2}$ case, convenient central points can be easily found in the form of the highest values reached in successive cycles (also the values on which we centered our cycles). To illustrate this quasi-mirror symmetry we show below 10 values on either side of $f_3[2869]$, the central point of the cycle of length 5739:
$f_3[2859:2868]$: 1.038574, 0.603576, 0.582792, 0.976221, 0.783863, 1.005719, 0.641789, 0.692073, 1.156569, 1.03528
$f_3[2869]$: 1.328204
$f_3[2870:2879]$: 1.035341, 1.156693, 0.692257, 0.642036, 1.006027, 0.784233, 0.976652, 0.583284, 0.60413, 1.03919
We notice that the corresponding mirrored values are not equal on either side but very close. Further, the difference is systematic, i.e. the values on one side are consistently higher than their counterparts on the other side. The pair closest to the central point (1.03528, 1.035341) differs by 6.158394 $\times 10^5$. The next pair by twice that amount, the next by thrice, the next by 4 times and so on. Thus, as one moves away from the center there is a linear increase in the asymmetry by a constant amount until one reaches the ends of the cycle. By the end of a cycle the difference between the quasi-mirror symmetric pairs reaches a maximum of $\approx$ 0.17. Thus, the minimum difference, i.e., the difference between members of the pair closest to the center-point is $\approx \tfrac{0.17}{l}$, where $l$ is the length of that cycle. Hence, as the cycles get larger the symmetry increases closer to the central point (Can be seen visually in above figures). Similarly, for the $f_3$ of $\phi$ we can establish the axis of mirror-symmetry as the being the central point of a cycle. Here too, the same dynamics as reported above for $\sqrt{2}$ are observed, but the maximum difference of a pair for a cycle is $\approx$ 0.22 and accordingly for a given cycle of length $l$ the minimum difference of the quasi-mirror symmetric pairs is $\tfrac{0.22}{l}$. We have not been able to figure out the significance of these maximum difference values for either sequence and remains an open problem. Moreover, this structure of $f_3$ is of some interest because it seems asymmetry (or randomness) or perfect symmetry are way more common than quasi-symmetry which we encounter here.

Case-2: Product-division floor-difference
Indeed, contrasting real symmetry is obtained in a related class of sequences that we discovered. We shall describe their properties in the final part of this article. Instead of the floor-difference described above, we use a related kind of operation using irrational square roots of integers define the following sequence:
$f_0[n]=\left \lfloor n \sqrt{2}\right \rfloor -2 \left \lfloor \dfrac{n}{\sqrt{2}}\right \rfloor$

This is a sequence of 0s and 1s: 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0…

Based on $f_0$ we can define, along the lines of what we did above, another sequence thus:
$f_1[n]=\displaystyle \sum_{k=1}^n f_0[k]==1$
It is the count of the number of 1 up to the $n$th term of sequence $f_0$. It is an integer sequence of the form: 1, 1, 1, 2, 3, 3, 4, 5, 5, 5, 6, 6, 6, 7, 8, 8, 8, 9, 9, 9, 10, 11, 11, 12, 13, 13, 13, 14, 15, 15…

As with the above cases, we observe that the value of $f_1[n]$ grows in a step-wise linear fashion with $n$. Thus we can again rectify it by determining its constant of this linear growth. We observe that in this case the $f_0$ as an equal number of 0s and 1s for a given length. Hence, we get the rectification constant as $\tfrac{1}{2}$. Thus, we can define a further sequence,
$f_2[n]=2f_1[n]-n$
We multiple by 2 instead of using $\tfrac{1}{2}n$ for rectification because we can that way keep $f_2$ an integer sequence.

Then, we define the next sequence based on $f_2$ thus:
$f_3[n]=\displaystyle \sum_{k=1}^n f_2[k]$

Since the distribution of $f_2$ in this case is symmetric about 0 we do not need any further rectification in defining $f_3$ and it remains an integer sequence. In this case the values of $f_3$ define a symmetric fractal with a bifid peak-like appearance (Figure 6).

Figure 6

Here again, the fractal repeats itself at each cycle, with increasing detail as the length of the cycle increases. However, at every cycle the fractal remains perfectly symmetrical unlike the above-discussed cases (Figure 7). We can define the length of each cycle for this fractal based on the palindromic structure of $f_3$ for each cycle: Each cycle begins and ends in the sub-sequence: 1, 1, 0, 0, 1, 1

Figure 7

We determined that the cycle-lengths show the progression: 26, 166, 982, 5738, 33458, 195022…
Strikingly, the maximum value reached by $f_3$ for each of these cycles shows the progression: 6, 35, 204, 1189, 6930, 40391…
Thus, the ratio of both successive cycle-lengths and the maximum height reached in successive cycles, remarkably, converges to $3+2 \sqrt{2}$ — this is the same as the convergent for the above $\sqrt{2}$ fractal derived from the floor-difference operation.
Notably, the successive partial sums of the continued fraction for $3+2 \sqrt{2}$ are,

6, $\dfrac{29}{5}$, $\dfrac{35}{6}$, $\dfrac{169}{29}$, $\dfrac{204}{35}$, $\dfrac{985}{169}$, $\dfrac{1189}{204}$, $\dfrac{5741}{985}$, $\dfrac{6930}{1189}$, $\dfrac{33461}{5741}$, $\dfrac{40391}{6930}$, $\dfrac{195025}{33461}$

We notice that the maximum value reached in each cycle is captured by the denominator and numerator of every 1, 3, 5, 7… $2n-1^{th}$ partial sum. The numerator minus 3 of every 2, 4, 6 … $2n^{th}$ sum captures the cycle-length: the reduction by 3 is evidently because we defined the cycle based on the re-occurrence of the palindrome.

This kind of sequence derived from the product and division by an irrational square root of an integer can be generated from such square roots too. Using $\sqrt{3}$ yields a fractal with a single peak (Figure 8).

Figure 8

Here, the cycle-lengths and maximum value attained by the $f_3$ converges to $\left(2+\sqrt{3}\right)^2=7+4\sqrt{3}$. In the case of $\sqrt{3}$ we also have minimum values of $f_3$, which are $<0$ (Figure 8); interestingly, the ratio of minimum values from successive cycles also converges to $7+4\sqrt{3}$. This number is the root of the quadratic equation $x^2-14x+1=0$

In conclusion, we find that two different operations of the floor function on irrational square roots or roots of quadratic equations yield fractals, whose cycle-lengths are convergents for roots of quadratic equations, which can be constructed based on the original root. The formal proof of this might be of interest to mathematicians. In the second case this also relates to the maximum value attained by the sequence $f_3$. Finally, it is notable that in the first case the values of $f_3$ show a certain quasi-mirror symmetry and an approximately normal distribution. Despite this overall distribution, the actually values are arranged in precise manner as to generate a fractal structure. This might yield an analogy to natural situations where a normally distributed population could organize into a highly, structured pattern.