# On Hofstadter Heart Sequences

Authors: Altug Alkan; Nathan Fox; O. Ozgur Aybar
Journal: Complexity
 (2017)

---

## Abstract

The HofstadterQ-sequence and the Hofstadter-Conway $10000 sequence are perhaps the two best known examples of meta-Fibonacci sequences. In this paper, we explore an unexpected connection between them. When the Q-sequence is subtracted from the Conway sequence, a chaotic pattern of heart-shaped figures emerges. We use techniques of Pinn and Tanny et al. to explore this sequence. Then, we introduce and analyze an apparent relative of the Q-sequence and illustrate how it also generates heart patterns when subtracted from the Conway sequence.


---

## Body

## 1. Introduction

The HofstadterQ-sequence is recursively defined by the nested recurrence relation Q(n)=Q(n-Q(n-1))+Q(n-Q(n-2)) and initial values Q(1)=Q(2)=1. This is sequence A005185 in Sloane’s On-Line Encyclopedia of Integer Sequences (OEIS) [1], and its first few terms are1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 6, 8, 8, 8, 10, 9, 10, 11, 11, 12,…In his bookGödel, Escher, Bach: An Eternal Golden Braid [2], Hofstadter introduced this sequence as a small mystery. He noted that, despite the simplicity of the sequence’s definition, the sequence values appear to be largely unpredictable. But there appears to be some sort of overarching structure (see Figure 1), a proof of which has thus far evaded mathematicians [3]. Even more frustratingly, it is unknown whether Q(n) evenexists for all n. If it happens that Q(n-1)≥n, then Q(n) would refer to a nonpositive index and fail to exist. In the event of such happenstance, we say that the Q-sequencedies. Based on the pattern in Figure 1 (which continues beyond the depicted terms), it is widely believed that the Q-sequence does not die. We know that it exists for at least 12∗109 terms [4].Figure 1
HofstadterQ-sequence.Golomb describes the interestingly erratic behavior ofQ-sequence as “wildly chaotic,” though he proved that if limn→∞⁡(Q(n)/n) exists, then it must be one half [5]. But, a priori, there is no reason this limit should exist; Golomb himself describes another sequence satisfying the Q-recurrence (A244477) for which the limit does not exist. This conditional limit value is essentially the only rigorous result proved about the Q-sequence [6]. For this reason, studies on the Q-sequence have primarily been experimental.Observations onQ-sequence clearly suggest that the beginning points of the apparent block structures are close to 3 times consecutive powers of 2. In order to explain the fractal-like behavior of Q-sequence, the first extensive study was carried out by Pinn [7]. In his work, Q(n) is described as a child of its “mother” Q(n-Q(n-1)) and “father” Q(n-Q(n-2)). With this methodology, Pinn partitions the values of n into interval “generations” that correspond to the “sausages” in Figure 1 and he noted that the first eleven generations have well-defined starting points, where the difference between Q(n) and n/2 suddenly jumps. Thereafter, a detailed statistical analysis indicates that the subsequent generations begin around odd powers of 2. More recently, Dalton et al. instead used a recursive method to detect generations [8]. They defined a function Mp(n), called the generation sequence for Q(n) based on spot p, by the recurrence Mp(n)=Mp(n-Q(n-1))+1 and initial conditions Mp(1)=Mp(2)=1. This function is used to determine the beginning points of the generations of Q-sequence. More precisely, the least value of t such that Mp(t) is equal to k gives g(k) that is defined as the start point of the kth generation of Q-sequence. Table 1 shows the values of g(k) (the starting points of the first eleven generations agree, regardless of which method is used; for generation numbers k>11, the two approaches give different points for starts of generations [8]) in the range we will consider for our sequences in this paper.Table 1
The values ofg(k) that refer to the start points of maternal generations of the Q-sequence.
m
1
2
3
4
5
g(m+11)
3031
6043
12056
24086
48043
g(m+16)
95286
189268
376996
750285
1497135
g(m+21)
2977109
5942404
11823550
23585708
47059762We have noted that theQ-sequence appears to have elements of chaos and structure. There are also many sequences that have similar definitions to the Q-sequences that are not chaotic [4–6, 9–12]. Some of these sequences have combinatorial interpretations involving counting leaves in infinite trees [10]. But, for us, the most important well-behaved meta-Fibonacci sequence is theHofstadter-Conway $10000 sequence (A004001, shortened to theConway sequence), given by recurrence C(n)=C(C(n-1))+C(n-C(n-1)) and initial conditions C(1)=C(2)=1. The name of this sequence comes from a prize of $10000 that John H. Conway offered for the discovery of a value of n such that |C(k)/k-1/2|<1/20 for all k>n. Mallows provided such an analysis just a few weeks after and he showed that corresponding n=1489 [13]. The sequence C(n) is monotone increasing with successive differences either 0 or 1, and limn→∞⁡(C(n)/n)=1/2. Furthermore, C(n)≥n/2 for all n, with equality if and only if n is a power of 2. Figure 2 is a plot of C(n)-n/2 that is symmetric in its zeros [11], which illustrates this sequence’s fractal-like structure. Mallows conjectured that graphs of these structures converge to a special curve form that can be parametrized in terms of the Gaussian distribution, and this is proved by Kubo and Vakil [11]. The Conway sequence, like the Q-sequence, can be partitioned into generations. In this case, the generation boundaries are the powers of 2. More precisely, the beginning point of the kth maternal generation is 2k-1+1 for k>1 [8].Figure 2
Hofstadter-Conway $10000 sequence, minusn/2.This paper is structured as follows. In Section2, we introduce and analyze the Hofstadter Chaotic Heart sequence, which is constructed as a difference of the Q-sequence and the Conway sequence. Then, in Section 3, we carry out a similar construction with a new sequence in place of the Q-sequence and we report a variety of interesting observations. Finally, we offer some concluding remarks in Section 4.


## 2. The Hofstadter Chaotic Heart Sequence

We wish to consider a difference of theQ-sequence and the Conway sequence. The Q-sequence seems to hover around n/2, whereas the Conway sequence never dips below n/2. For this reason, it is more natural to consider the Conway sequence minus the Q-sequence.Definition 1.
LetH(n)=C(n)-Q(n), where Q(n) denotes the nth term in the Q-sequence and C(n) denotes the nth term in the Conway sequence.We call the sequenceH(n)n≥1 the Hofstadter Chaotic Heart sequence (A284019). The reason for this name should be clear from a glance at its plot in Figure 3. At this point, it would be nice to observe appearance process of erratic heart shapes with increasing numbers of generations. For a plot of successive generations of the Hofstadter Chaotic Heart sequence, see Figure 4.Figure 3
Hofstadter Chaotic Heart sequence.Figure 4
Hofstadter Chaotic Heart sequence for increasing values ofk (generation number).The sequence has a fractal-like structure of ever-growing hearts. The heart shapes can be described by considering the following ingredients:(i)
TheQ-sequence is built out of apparently self-similar “sausages.”(ii)
TheQ(n)-n/2 is approximately symmetric within each generation.(iii)
TheQ-sequence appears to grow approximately like n/2.(iv)
TheQ-sequence has generational divides around 3 times powers of 2, which sit halfway between consecutive powers of 2.(v)
The Conway sequence grows liken/2.(vi)
The Conway sequence has self-similar generations divided at powers of 2.(vii)
C(n)-n/2 is symmetric about 3 times the power of 2 that started the preceding generation.(viii)
C(n)-n/2≥0.All of these points together imply that the bottom of each heart should be near a power of 2, and this is precisely what is observed. This is all summarized in Figure5. We also marked the initial values of g(k) in order to show the determinative role of generational structure of Q-sequence.Figure 5
Hofstadter Chaotic Heart sequence withC(n)-n/2 overlaid.We shall now analyze the Hofstadter Chaotic Heart sequence using Pinn’s statistical technique and the Maternal Spot Generation method (we also study the same analysis with Pinn’s generational method that estimates whether the integer part of2k-1/2 is the beginning point of the kth generation of Q-sequence for k≥12; results observed are mainly similar to the values of Table 2). As in Pinn’s work, let B(n)=C(n)-n/2, and let S(n)=Q(n)-n/2. In our analysis, we will not use the integral part of n/2 unlike Pinn’s work [7], in order to prevent information loss in statistical analysis. In other words, B(n) and S(n) give noninteger terms for odd values of n. For a given sequence F(n), let us define, as Pinn does, Mk(F(n))2 (see below), a variance of sorts for F(n), where the indices n considered are in the kth generation. Also borrowing notation from Pinn, let 〈F(n)〉k denote the average value of F(n) over the kth generation, and define α(k,F(n)), Nk(B(n),S(n)), and β(k,B(n),S(n)) as below. In our analysis, kth generation boundaries are taken from Table 1 because of the observation in Figure 5 that clearly suggests that generational boundaries of Q-sequence are also boundaries of the heart patterns. For example, if k=13, then g(13)=6043 is the first index and g(14)-1=12055 is the last index for the computation of the following quantities:(i)
Mk(F(n))2=〈F(n)2〉k-〈Fnk2(ii)
α(k,F(n))=log2⁡(Mk(Fn)/Mk-1(F(n)))(iii)
Nk(B(n),S(n))2=〈B(n)∗S(n)〉k-〈B(n)〉k∗〈S(n)〉k(iv)
β(k,B(n),S(n))=log2⁡(Nk(B(n),S(n))/Nk-1(B(n),S(n)))Table 2
The values ofα(k,S(n)), α(k,B(n)), α(k,H(n)), and β(k,B(n),S(n)) for Maternal Spot Generation intervals on the Q-sequence.
k
α
(
k
,
S
(
n
)
)
α
(
k
,
B
(
n
)
)
α
(
k
,
H
(
n
)
)
β(k,B(n),S(n))
10
0.848
0.889
0.871
0.965
11
0.762
0.908
0.822
0.994
12
0.875
0.907
0.886
0.993
13
0.878
0.933
0.904
0.994
14
0.879
0.925
0.900
0.996
15
0.882
0.944
0.917
0.991
16
0.887
0.919
0.903
0.976
17
0.885
0.939
0.914
0.988
18
0.880
0.932
0.909
0.994
19
0.887
0.948
0.922
0.989
20
0.884
0.945
0.921
0.998
21
0.889
0.949
0.927
0.984
22
0.881
0.954
0.928
1.000
23
0.888
0.951
0.930
0.986
24
0.884
0.959
0.935
0.998
25
0.885
0.956
0.936
0.995SinceH(n)=B(n)-S(n), for the same kth generation boundaries, it is clear that Mk(H(n))2=Mk(B(n))2+Mk(S(n))2-2∗Nk(Bn,Sn)2,α(k,H(n))=α(k,S(n))+1/2∗log2⁡(γk(B(n),S(n))/γk-1(B(n),S(n))), where γk(B(n),S(n))=1+(Mk(B(n))/Mk(S(n)))2-2∗(Nk(B(n),S(n))/Mk(S(n)))2. See Table 2 for the values of α for S(n), B(n), and H(n) and the values of β(B(n),S(n)) in our experimental range.


## 3. The “Brother” Sequence

Aside from theQ-sequence, there are many other solutions to Hofstadter’s Q-recurrence with different initial conditions [6]. Are there any other initial conditions for Hofstadter’s Q-recurrence such that C(n)-Q(n) has a fractal-like structure of ever-growing hearts where C(n) is the Conway sequence? We aimed to find a simple answer for this question. Therefore, firstly, we have done experiments on Q-recurrence with three initial conditions. Let us denote the initial conditions Q(1)=q1, Q(2)=q2, and Q(3)=q3 by (q1,q2,q3), where q1,q2,q3≥1. In this case, the sequence with the initial conditions (1,1,2) is Hofstadter’s Q-sequence. Sequences with initial conditions (1,2,3), (1,3,1), (2,3,3), (a,1,1), and (b,1,2) are essentially the same as Hofstadter’s Q-sequence for all a≥1 and b>1. Sequences with initial conditions (3,2,1) (A244477) and (1,3,2) are quasi-periodic [5]. Initial conditions (1,2,2), (2,2,2), (2,2,3), (3,2,2), and (5,2,1) give sequences which are much more chaotic compared to the Q-sequence. All other combinations of (q1,q2,q3) immediately die except (2,2,1). The only remaining sequence is the one with initial conditions (2,2,1) that has a behavior so closely related to the Q-sequence itself and thus we call it theBrother sequence.Definition 2.
LetQb(n) be defined by the recurrence Qb(n)=Qb(n-Qb(n-1))+Qb(n-Qb(n-2)) for n>3, with the initial conditions Qb(1)=Qb(2)=2, Qb(3)=1.The first few terms of the Brother sequence (A284644) are2, 2, 1, 3, 5, 3, 5, 6, 4, 6, 10, 5, 7, 9, 9, 10, 11, 11, 12,….Definition 3.
LetHb(n)=C(n)-Qb(n), where Qb(n) denotes the nth term in the Qb-sequence and C(n) denotes the nth term in the Conway sequence.Figure7 shows the plot of the sequence Hb(n). See also Figure 8 for the appearance process of heart patterns with increasing numbers of generations. In fact, the hearts here are more clearly defined, as a result of the more gradual beginnings of the sausage structures in the Brother sequence.Figure9 depicts the Brother sequence. Like the Q-sequence, it appears to be composed of self-similar chaotic sausages staying near n/2. Also, like the Q-sequence, it is easy to show that if limn→∞⁡(Qb(n)/n) exists, it must be equal to 1/2. Interestingly, the junctions between the sausages of the Brother sequences themselves appear to consist of smaller sausages (see Figure 11).We now study the generational structure ofQb(n). Our purpose is to compute α(k,Sb(n)), where Sb(n)=Qb(n)-n/2. Note that we defined α(k,F(n)) and 〈F(n)〉k for a corresponding F(n) in the previous section. Keeping those definitions in mind, we need to determine intervals that contain each main block of the Brother sequence in our measurement range. We will call thesemain blocks because of the observation, shown in Figure 11, that there are also smaller block structures. To determine the starting points of main blocks, we employ the following method. When the minimum of the father (n-Qb(n-2)) and mother (n-Qb(n-1)) spots is greater than or equal to the first member of the kth generation, we define n as the first member of the (k+1)st generation. In the range of our experiments, this methodology partitions the data cleanly into generations. To quantify the purity of our generations, we define ϵ(k,Sb(n)) to be the proportion of terms in the kth generation whose father or mother spot is located in the (k-2)nd generation. If ϵ is close to 0, then the generations are close to pure.In our case,Qb(1) will be the beginning of the first generation, and Qb(3) will be the beginning of the second generation. We now define some auxiliary sequences (similar auxiliary sequences can also be defined for the Conway sequence; let c1(n) be the least m such that mother (m-C(m-1)) spot is equal to n and c2(n) = c1(c2(n-1)) for n>2 with c2(1)=1 and c2(2)=3; in this case, c2(k) is the start point of the kth maternal generation which is given in [8]) for the approximation that is mentioned above.Definition 4.
LetW(n) be the least m such that the minimum of father (m-Qb(m-2)) and mother (m-Qb(m-1)) spots is greater than or equal to n.Definition 5.
LetP(n)=W(P(n-1)) for n>1, with P(1)=1.See Table3 for the first 25 values of P(n). We can confirm that the terms of P(n) can be limits of intervals that contain each main block in our experimental range. See Figure 10 for an example, that is, P(17).Table 3
The values ofP(n) sequence: these points will be used as start points of generations in order to compute statistical quantities of Qb(n).
m
1
2
3
4
5
P(m+0)
1
3
8
19
41
P(m+5)
85
173
349
701
1405
P(m+10)
2800
5576
11128
22221
44342
P(m+15)
88422
176507
352062
702831
1403235
P(m+20)
2802382
5598862
11185734
22353592
44674558So, we will use them as the beginning of our generations in order to compute statistical quantities that we mentioned above and in the previous section. Table4 shows the main statistical quantities with this partition.Table 4
log
2
⁡
(
M
k
(
S
b
(
n
)
)
), α(k,Sb(n)), β(k,Sb(n),S(n)), and ϵ(k,Sb(n)) values for generations that P(n) sequence determines.
k
log2⁡(Mk(Sb(n)))
α
(
k
,
S
b
(
n
)
)
β(k,Sb(n),S(n))
ϵ(k,Sb(n))
10
6.129
0.764
0.985
0.049
11
6.960
0.831
0.994
0.050
12
7.774
0.815
1.000
0.042
13
8.637
0.863
0.999
0.033
14
9.506
0.869
0.996
0.029
15
10.384
0.877
0.995
0.026
16
11.250
0.866
0.999
0.023
17
12.128
0.878
0.995
0.019
18
13.004
0.877
0.999
0.017
19
13.885
0.881
0.998
0.014
20
14.766
0.881
0.998
0.012
21
15.647
0.881
0.999
0.009
22
16.528
0.881
0.998
0.007
23
17.409
0.881
0.999
0.006
24
18.292
0.883
0.999
0.005Let us now elucidate Figure11 in more depth. To this end, we need the following definition.Definition 6.
LetG(n) be the sequence of numbers t such that Qb(t)=Qb(t-1)=Qb(t-2)=Qb(t-3).We have computed the first few terms ofG(A287118): 84, 172, 348, 700, 1404, 2720, 2754, 5448, 10904, 21816, 43640, and 87288.TheG numbers are significative for the Brother sequence in order to detect the junctions of small elliptic-like sausages up to 105. For example, 87288 is the index of the juncture of small sausages in Figure 11. Detailed analysis of generational characteristics of smaller block structures in the connection of main blocks can be a future work. However, we will mention some properties of the G sequence that exhibits some curious patterns. For example, G(n)=P(n+5)-1 for 0<n<6. Additionally, there is an interesting order that Qb(n) sequence has for n<105. Table 5 simply summarizes this. Results show that 2754 is an exception in terms of quantity of (Qb(G(n)+1)-Qb(G(n)))/Qb(G(n)). This observation has significance since different studies have searched order signs in highly chaotic nature of Q-sequence [7, 8]. In here, Qb(n) that is an apparent relative of Q-sequence exhibits an unexpected pattern on the juncture of small elliptic-like sausages in short scale.Table 5
Hidden order thatG(n) sequence shows on Qb(n) sequence.
n
Qb(G(n))
Qb(G(n)+1)
(Qb(G(n)+1)-Qb(G(n)))/Qb(G(n))
1
11∗22
3∗24
1
11
2
11∗23
3∗25
1
11
3
11∗2^4
3∗2^6
1
11
4
11∗25
3∗27
1
11
5
11∗26
3∗28
1
11
6
11∗31∗22
19∗32∗23
1
(
11
∗
31
)
7
3∗5∗23∗22
347∗22
2
(
3
∗
5
∗
23
)
8
11∗31∗23
19∗32∗24
1
(
11
∗
31
)
9
11∗31∗24
19∗32∗25
1
(
11
∗
31
)
10
11∗31∗25
19∗32∗26
1
(
11
∗
31
)
11
11∗31∗26
19∗32∗27
1
(
11
∗
31
)
12
11∗31∗27
19∗32∗28
1
(
11
∗
31
)We want to confirm the validity of numerical results in Table4. To this aim, we can choose two different constants and do a careful examination. Between 210 and 224, experimental observations indicate that [22-1+k, 22+k] and [2sin⁡e+k, 2sin⁡e+k+1] can be limits of intervals that contain each main block. With both limits for successive main blocks, computations show that the value 0.88 appears. Note that both constants are determined by observation on a limited range, so both constants that are 22-1 and 2sin⁡e should be seen as a tool for partitioning the sequence into similar main blocks in order to compute and confirm α(k,Sb(n)).The results of computation ofα(k,Sb(n)) have significance because 0.88 is the constant that Pinn conjectures in his analysis of the Q-sequence (we also confirmed that α(k,Sb(n)-S(n)) oscillates around 0.88 for the generational boundaries that are determined by Table 3 in our experimental range) [7], and he obtains the same constant for a similar analysis of a different sequence [14]. It seems that α(k,Sb(n)) fluctuates around 0.88 with more orderly behavior. Additionally, β(k,Sb(n),S(n)) seems fascinatingly stable around 1.Since we know the certain generational properties of the Brother sequence now, we are ready to analyze the sequenceHb(n) in our experimental range. Our previous analysis suggests B(n)-Hb(n)≃nα(k,Sb(n)) for sufficiently large k. We carry out analysis similar to the previous section. We use the generational boundaries of the Brother sequence that Table 3 represents. See Table 6 for the results that we obtained. Comparison between Figures 6 and 12 suggests that the signs of order are more evident in here. In this case, β(k,B(n),Sb(n)) seems really more stable than β(k,B(n),S(n)) and α(k,Hb(n)) is smaller than α(k,H(n)) for all 10≤k≤24 except k=11.Table 6
The values ofα(k,Sb(n)), α(k,B(n)), α(k,Hb(n)), and β(k,B(n),Sb(n)) for the generations of the Qb-sequence.
k
α
(
k
,
S
b
(
n
)
)
α
(
k
,
B
(
n
)
)
α
(
k
,
H
b
(
n
)
)
β
(
k
,
B
(
n
)
,
S
b
(
n
)
)
10
0.764
0.900
0.790
0.979
11
0.831
0.916
0.850
0.985
12
0.815
0.907
0.832
0.995
13
0.863
0.942
0.882
0.996
14
0.869
0.919
0.882
0.993
15
0.877
0.947
0.897
0.992
16
0.866
0.929
0.884
0.996
17
0.878
0.952
0.900
0.993
18
0.877
0.939
0.896
0.996
19
0.881
0.957
0.907
0.996
20
0.881
0.952
0.906
0.997
21
0.881
0.960
0.911
0.998
22
0.881
0.962
0.914
0.997
23
0.881
0.961
0.916
0.998
24
0.883
0.968
0.922
0.998Figure 6
Graph of Table2 (blue: α(k,S(n)), red: α(k,B(n)), green: α(k,H(n)), black: β(k,B(n),S(n))). In our experimental range, β(k,Bn,S(n)) is oscillating as an upper bound and α(k,H(n)) is increasing with decreasing fluctuations thanks to domination of α(k,B(n)), while α(k,S(n)) confirms Pinn’s conjecture.Figure 7
Heart sequenceHb(n)=C(n)-Qb(n).Figure 8
Heart sequenceC(n)-Qb(n), successive generations.Figure 9
Graph ofQb(n) for 1≤n≤250000.Figure 10
Illustration ofP(17)=176507 on the scatterplot of Qb(n).Figure 11
Graph ofSb(n) for 80000≤n≤95000: small elliptic-like sausages appear in the connection of big sausages; more precisely, G(12)=87288 exactly gives the position of juncture of evident small elliptic-like sausages.Figure 12
Graph of Table6 (blue: α(k,Sb(n)), red: α(k,B(n)), green: α(k,Hb(n)), black: β(k,B(n),Sb(n))).


## 4. Conclusion

This study aims to offer a different perspective on meta-Fibonacci sequence. We aim to suggest that there are undiscovered and interesting facts behind two famous meta-Fibonacci sequences and the relations between them. We have carried out a variety of experiments in order to understand the nature of the Hofstadter heart sequences that we introduce. While we explore the Hofstadter Chaotic Heart sequence, we also introduce and study the Brother sequence, which offers meaningful experimental results and intriguing observations in terms of new inferences for Hofstadter’sQ-recurrence. Future work could potentially undertake a more detailed analysis of its generational structure than we have done here. This study also suggests that there is a mysterious classification of chaotic meta-Fibonacci sequences determined by common characteristics of their respective generational structures.



---

*Source: 2614163-2017-11-20.xml*