0
Views
0
CrossRef citations to date
0
Altmetric
Research Article

A diluted version of the problem of the existence of the Hofstadter sequence

&
Received 16 Nov 2023, Accepted 30 Jul 2024, Published online: 09 Aug 2024

Abstract

We investigate the conditions on an integer sequence f(n), nN, with f(1)=0, such that the sequence q(n), computed recursively via q(n)=q(nq(n1))+f(n), with q(1)=1, exists. We prove that f(n) is ‘slow’, that is, f(n+1)f(n){0,1}, n1, is a sufficient but not necessary condition for the existence of sequence q. Sequences q defined in this way typically display non-trivial dynamics: in particular, they are generally aperiodic with no obvious patterns. We discuss and illustrate this behavior with some examples.

2020 Mathematics Subject Classifications:

1. Motivation

In his 1979 book [Citation3], author D.R. Hofstadter mentions an integer sequence, qh(n), defined, for n>2, by (1) qh(n)=qh(nqh(n1))+qh(nqh(n2))withqh(1)=qh(2)=1.(1) In order for qh(n) to exist for all positive integers n, that is, for nN, it must be true, again for all nN, that 1qh(n)n, since only then does the right-hand side of (Equation1) refer to terms that are already known: qh(n) is undefined for n0. Should it happen that qh(n)>n for some n, the sequence is said to die at n. Although direct computation shows that qh(n) exists for 1n3×1010 [Citation5], the existence of qh(n) for all positive n is still an open question.

The sequence qh(n) is non-monotonic, aperiodic and its dynamical behavior appears to be complex. In [Citation9] for instance, small scale ‘chaotic’ behavior is described, with some order apparent at larger scales, and several statistical properties of the sequence are also investigated.

This complex behavior has inspired several authors to study variations of Hofstadter's original recursion. For instance, Tanny [Citation11] considers T(n)=T(n1T(n1))+T(n2T(n2))withT(0)=T(1)=T(2)=1,for n>2 [Citation6]. Another variant is considered in [Citation1], in which the authors investigate V(n)=V(nV(n1))+V(nV(n4))withV(1)=V(2)=V(3)=V(4)=1for n>4 [Citation7]. Both these variants give rise to sequences that are monotonic, unlike qh(n), and hit every positive integer.

A different approach is followed in [Citation2], in which the recursion formula in (Equation1) is retained but different initial conditions are used. For certain initial conditions, ‘eventually quasi-polynomial’ solutions can be found. For a given integer m>0 and a given fixed set of polynomials pi(n), i=0,,m1, a quasi-polynomial function of n, h(n), say, is defined by h(n)=pi(n), where i=nmodm. If this holds only for n greater than some positive integer n0 say, then h(n) is said to be eventually quasi-polynomial. In [Citation2], families of eventually quasi-polynomial solutions to (2) r(n)=r(nr(n1))+r(nr(n2)),(2) with suitable initial conditions, are constructed. As an example of such a solution with m = 5 and where the pi(n) are of degree at most 1, we give i01234pi(n)2n45n5n6,

along with the initial conditions r(3),,r(12)=1,1,3,5,1,4,7,6,4,9. (Values of r(1) and r(2) are not needed to compute r(n),n>2.) For all n>n0=12 here, r(n) satisfying (Equation2) is then given by the quasi-polynomial above.

In this paper, we also consider a variation on the original problem, one which consists of an infinite number of variants rather than just a single case. In particular, we discuss a ‘diluted’ version of the problem of the existence of qh(n). In order to describe this version, we first need the notation (a(n))nN:=a(1),a(2), for an infinite sequence. We use this notation in formal contexts, such as in definitions and lemmas, but where it it is clear what is intended, we just write a to mean the whole sequence. Naturally, when the nth term is meant, we write a(n). We also need the following definitions:

Definition 1.1

Slow sequence

If integer sequence (a(n))nN obeys a(n+1)a(n){0,1} for nN, then the sequence is said to be ‘slow’.

Definition 1.2

Property S0

If integer sequence (a(n))nN is slow and additionally a(1)=0, then it is said to have property S0.

We drop the quotation marks around the word ‘slow’ from now on.

The problem that we consider is the question of the existence of sequences q defined recursively by (3) q(n)=q(nq(n1))+f(n)withq(1)=1,(3) for nN, n>1, and where f(n) has property S0 (so in particular f(1)=0). All sequences in the paper start from index 1 and we apply the conditions q(1)=1 and f(1)=0 strictly throughout, even though f(1) is never needed to compute the sequence q. Computations suggest that, under these conditions, the sequence q corresponding to any f with property S0 exists for all nN.

We think of sequences generated by (Equation3) as ‘diluted’ Hofstadter sequences because of the similarity of their definition to that of the original qh-sequence. In particular, in (Equation3), one ‘difficult’ – nested – term is retained, q(nq(n1)), but the second nested term is replaced by f(n), which is under our control.

Clearly the existence of the sequence q is also equivalent to the inequality 1q(n)n holding for all nN. If this is the case, then we simply say that q exists. The lower bound on q(n) here is easy: by (Equation3), for any n for which q exists, q(n) is the sum of a positive integer and a non-negative one, and so is also greater than or equal to unity.

The upper bound on q, however, is less obvious. In what follows, after some preliminaries, we give a proof of the following theorem.

Theorem 1.3

For all sequences (f(n))nN having property S0, the corresponding sequence (q(n))nN with q(1)=1 and with q(n), for n>1, computed from (Equation3), exists for all nN.

The proof of this theorem is the main result of the paper, but the recursion (Equation3) can also be viewed as a non-linear (in the light of the nested term), non-autonomous (because of f(n)) dynamical system, discrete in both time and space. Hence, having proved the existence of q for all f with property S0, we make some observations about the dynamics of sequences q, which are also interesting.

2. Preliminaries

The first term of all sequences in this paper has index 1. We start by giving the following definitions:

  • Two sequences (a(n))nN and (b(n))nN differ if there exists nN such that a(n)b(n); otherwise, they are equal.

  • A sequence (q(n))nN obeying (Equation3) exists if and only if q(n) is defined for all nN; or, equivalently, if 1q(n)n for all nN.

  • A sequence Q(f):=(q(n))nN is the sequence corresponding to sequence (f(n))nN if (q(n))nN exists and is defined by (Equation3).

  • A sequence F(q):=(f(n))nN is the sequence corresponding to sequence (q(n))nN if (q(n))nN exists and f(n) is defined by f(1)=0 and f(n)=q(n)q(nq(n1)) for n>1.

Where an explicit expression for f(n) is available, for example f(n)=n/2, we may write Q(n/2).

Where we need to refer explicitly to the first few terms of a sequence, a(n) say, we list the values starting from a(1) – for example a=(1,2,4,4) means a(1)=1, a(2)=2, a(3)=a(4)=4.

Let us define S as the set of all sequences having property S0: that is S:={(f(n))nN:f(1)=0,f(i+1)f(i){0,1}foriN}.We will also need the set of finite sequences with property S0: Sm:={(f(n))n=1,,m:f(1)=0,f(i+1)f(i){0,1}fori=1,,m1}.It is easily established that the cardinality of S is the same as that of the real numbers. To do so, let fS and consider the sequence of differences (f(i+1)f(i))iN, which will be a sequence consisting of the symbols 0 and 1. Interpreting this as a binary decimal, we see that each distinct fS gives rise to a distinct real number x[0,1].

One important subset of S, with same cardinality, is G:={(f(n))nN=αnwithα[0,1)}.

It is easy to see (i) that GS, and that in fact (ii) GS. Property (i) comes directly from the definition x:=max{kZ:kx}, from which we deduce that, for α[0,1], α(n+1)αn is either 0 or 1. For property (ii), consider the sequence a(1),,a(4)=0,0,1,2, which are the first four terms of a sequence in S. Now assume that these terms are generated by a(n)=αn for some α. Then a(2)=0 implies that α[0,1/2), but a(4)=2 implies that α[1/2,3/4), leading to a contradiction. Hence, there are sequences in S that are not in G.

Furthermore, the condition that successive terms in a sequence f(n) differ by at most unity turns out to be sufficient but not necessary for the corresponding (q(n))nN to exist. There are examples where f increases by more than unity, and where it is not monotonic, but for which Q(f) nonetheless exists. Consider, for instance, (a) fa=(0,0,2,2,4,4,), for which qa=Q(fa)=(1,1,3,3,5,5,) and (b) fb=(0,1,0,1,0,1,), for which qb=Q(fb)=(1,2,1,2,1,2,). Statements (a) and (b) are proved in

Lemma 2.1

If fa(n)=2n12=n3+(1)n2,thenqa(n)=n1+(1)n2and if fb(n)=1+(1)n2,thenqb(n)=3+(1)n2for all nN.

Proof.

These just boil down to computation.

For qa, we have nqa(n1)={1niseven2nisodd,so qa(nqa(n1))=1 for all n. Hence, qa(n)qa(nqa(n1))=qa(n)1=n3+(1)n2=fa(n), as claimed.

For fb, we have nqb(n1)={n1nisevenn2nisodd.Hence, nqb(n1) is odd, and so qb(nqb(n1))=1, both for all n. Therefore, qb(n)qb(nqb(n1))=qb(n)1=1+(1)n2=fb(n).

Remark 2.2

Example (b) is in fact a special case of IfmNandf(n)=(n1)modm,thenq(n)=f(n)+1=((n1)modm)+1.

On the other hand, it is easy to find examples of fS for which Q(f) does not exist – for instance, f=(0,2,2), for which q(1)=1,q(2)=3 and so q(3)=q(0)+f(3) which is undefined.

We also prove

Lemma 2.3

If f and f are different sequences, and Q(f) and Q(f) both exist, then Q(f)Q(f).

Proof.

Let f(n)=f(n) for 1nk but f(k+1)f(k+1). Write q=Q(f), q=Q(f). Now, q(n)=q(n) for 1nk and q(k+1)=q(k+1q(k))+f(k+1), q(k+1)=q(k+1q(k))+f(k+1). Also, k+1q(k)=k+1q(k), but f(k+1)f(k+1). Hence q(k+1)q(k+1) and so the sequences q, q differ.

We remark here that the recursion (Equation3) can be used in either direction. That is, given any sequence f for which q=Q(f) exists, sequence q can obviously be computed, term-by-term, in order of increasing index, from (Equation3); and, given any sequence q obeying 1q(n)n for all n, (Equation3) can be used to compute f(n) for all n. A case where computing f given q gives an interesting result is

Lemma 2.4

Let sequence q(n) obey (i) 1q(n)n and (ii) q(n+1)q(n){0,1}, both for nN, and let q(1)=1. Define f(n)=q(n)q(nq(n1)) for n2 with f(1)=0. Then, for n1, f(n+1)f(n){1,0,1}.

Proof.

Throughout the proof, we assume integer n2. Assumption (i) tells us that q exists and (ii), that q is slow. By the definition of f(n), f(n+1)f(n)=q(n+1)q(n):=A(n)[q(n+1q(n))q(nq(n1))]:=B(n).Assumption (ii) implies immediately that A(n){0,1}.

Now define (n):=nq(n1): by (i), 1(n)n1. Then (n+1)(n)=1(q(n)q(n1)){0,1}, again by (ii). Hence, B(n) is either q((n))q((n))=0, or q((n)+1)q((n)){0,1}. Therefore, B(n){0,1}. Thus we have A(n)B(n){1,0,1} and the lemma is proven.

Note that the converse of Lemma 2.4 is not true: if f(n+1)f(n){1,0,1} then q is not necessarily slow: a counterexample is given by fb in Lemma 2.1.

Finally, we point out that cases in which fS gives rise to a monotonic sequence q appear to be rare – a few examples, each of which is also slow, are given in Section 4.

3. The main theorem

We now give a proof of Theorem 1.3. We need several lemmas, the first of which is

Lemma 3.1

The shift property

Let (f(n))nN, with f(1)=0, be any sequence of integers for which the corresponding sequence (q(n))nN=Q(f), with q(1)=1, exists. Define (f(n))nN:={0n=1f(n1)n>1and(q(n))nN:={1n=1q(n1)n>1.Then we have that (A)q=Q(f) implies q=Q(f) and (B)f=F(q) implies f=F(q).

Proof.

A ⇒ B. We use strong induction and the fact that both q and q obey (Equation3).

First, q(1)=q(1)=1 by definition, and q(2)=q(2q(1))+f(2)=1+f(1)=1. Hence, q(2)=q(1).

Next, assume that (4) q(n)=q(n1)forn=3,,kwithk>3.(4) Now, by assumption (Equation4), we have that q(k)=q(k1). For the inductive step kk+1, we have that q(k+1)q(k)=q(k+1q(k))q(kq(k1))=q(k+1q(k1))q(kq(k1))=q(m+1)q(m),where m=kq(k1). We have 2m+1k, since q exists, and so, by (Equation4), q(m+1)=q(m) and hence q(k+1)=q(k).

B ⇒ A. This is straightforward. By definition, we have f(1)=0. Then, by B, we have q(1)=1 and q(2)=q(1)=1. Hence, by (Equation3), f(2)=q(2)q(2q(1))=0. Then, letting n3, we have f(n)=q(n)q(nq(n1))=q(n1)q(n1q(n2))=f(n1),as claimed. Here we have used B and (Equation3) for the second-last and last equalities respectively.

We will also need the following two special cases of fS, each of which, unusually, leads to a slow sequence q:

Lemma 3.2

Let f0(n)=0 and f1(n)=n1, both for all nN, and define sequences q0=Q(f0), q1=Q(f1). Then q0(n)=1 and q1(n)=n, also for all n.

Proof.

For q0(n), (Equation3) gives q0(n)=q0(nq0(n1)) since f0(n)=0. By induction, with base case q0(1)=1, we make the assumption that for some k>1 we have q0(k)=1. Then, by the recursion formula, we have q0(k+1)=q0(k+1q0(k))=q0(k)=1, as claimed.

For q1(n), (Equation3) gives q1(n)=q1(nq1(n1))+n1 since f1(n)=n1. With q1(1)=1, we assume that q1(k)=k for some k>1. Then q1(k+1)=q1(k+1q1(k))+k=q1(1)+k=k+1and the proof is complete.

In the remainder of this section, f will always have property S0 and we will assume that f is such that Q(f) exists. We introduce the handy notation {j:k}, with kj, to designate the set of successive integers {j,j+1,,k}.

We now consider the question: for a particular n, given that f(n)=i{0:n1}, what are the possible values of q(n)? That is, we investigate the sets {q(n)|f(n)=i}, where f ranges over Sn. The lower bound on each of these sets is given by

Lemma 3.3

If Q(f) for fS exists, then (i) for nN and i=0,,n1, min({q(n)|f(n)=i})=i+1; and (ii) a sequence f that gives rise to this minimum value is (f(k))k=1,n=(0,,0,nizeroes1,2,,i).

Proof.

For (i), if n = 1 then, by the initial conditions, f(1)=0 and q(1)=1=f(1)+1; and so the claimed lower bound holds. Therefore, fix n>1 and recall that q(n)=q(nq(n1))+f(n)=q(nq(n1))+i. Then, provided that q exists, 1q(k)k for 1kn. In particular 1q(n1)n1 and so 1nq(n1)n1. Recall now that we are considering f(n)=i. Hence, q(n)=q(j)+i, where 1jn1, so 1q(j)n1. Therefore, q(n)i+1, and this gives the required minimum.

For (ii), we use Lemmas 3.1 and 3.2. In order that f(n)=i, we must have in1, otherwise f cannot have property S0. If f(n)=n1, then, by Lemma 3.2, q(n)=n can be achieved by choosing f=(0,1,,n1). Otherwise, f(n)=i<n1 and in this case, the shift property of Lemma 3.1 applied (ni1) times gives q(n)=i+1.

We have easily found the minimum of the sets {q(n)|f(n)=i}, but the corresponding maximum is not so straightforward. There is, however, a way round the problem. We require the definition of two collections of finite sets of integers, T and U, both of which have the same triangular structure. Taking T first, this is the collection of sets Ti,n, where nN and i=0,,n1, which can be pictured as a triangular arrangement with n indexing rows and i indexing the position within row n. The definition of T is

Definition 3.4

T is the collection of sets Ti,n:={q(n):q=Q(f),fSsuch thatf(n)=i},with nN and 0in1.

By Lemma 3.2 we have (5) T0,n={1}(a)andTn1,n={n}(b),(5) for nN. For (a), if fS and f(n)=0, then it must be that f(i)=0 for 1i<n and so the first part of Lemma 3.2 applies. For (b), if fS, the only way that f(n)=n1 is if f(i)=i1 for 1i<n, so the second part of Lemma 3.2 applies.

We have not succeeded in computing T explicitly for all valid i and n. In principle, T can be computed by finding all the values that q(n) can take given that fS and f(n)=i. This would in turn require knowledge of all the values that q(nq(n1)) can take (and then adding i=f(n) to them). In practice, though, it seems that we have insufficient knowledge of the sequences q=Q(f) as f ranges over S.

However, we can explicitly construct a collection of sets, U, and the sets in U will turn out to contain the corresponding sets in T. This is sufficient to prove Theorem 1.3. The collection U consists of the sets (6) Ui,n:={{1}i=0{i+1:n}i=1,,n1.(6) for nN.

We now prove

Lemma 3.5

Let collections of sets T and U be as in Definition 3.4 and Equation (Equation6) respectively. Then Ti,nUi,n for nN and i=0,,n1.

Proof.

First, note that for i = 0, (Equation5)(a) applies and gives T0,k={1}=U0,k. Furthermore, for i= k, (Equation5)(b) applies, giving Tk1,k={k}=Uk1,k. Both of these are true for all positive k.

The rest of the proof proceeds by strong induction, starting from T0,1={1}=U0,1. We assume that Ti,nUi,n for all allowed values of i and n=1,,k, which assumption we refer to as (H). We then study what happens when kk+1. The lemma having been proved for i = 0 and i = k, it only remains to study the case 1ik1.

Let us therefore consider Ti,k+1 with 1ik1. Equation (Equation3) now reads q(k+1)=q(k+1q(k))+i since, by definition, f(k+1)=i. We first need the set of possible values of q(k)|f(k+1)=i, which, by (H), is Ti1,kTi,kUi1,kUi,k={i:k}. Only sets with indices (i1,k) and (i,k) are allowed because f has property S0: f(k+1)=i can only be true if f(k)=i1 or f(k)=i. Thus, k+1q(k){1:ki+1}. Note that 2ki+1k, since 1ik1, so q(k+1q(k)) is defined only in terms of q with argument strictly less than k + 1. Hence, informally put, q(k+1q(k)) {union of rows 1 to ki + 1 of T}; that is, using assumption (H) and (Equation6), (7) q(k+1q(k))|f(k+1)=in=1ki+1j=0n1Tj,nn=1ki+1j=0n1Uj,n={1:ki+1}.(7) Therefore, for 1ik1, we have q(k+1){i+1:k+1} and so Ti,k+1{i+1:k+1}. Hence, from (Equation6), we have Ti,k+1Ui,k+1 and this completes the proof.

Finally, we are in a position to prove Theorem 1.3.

Proof of Theorem 1.3

An immediate consequence of Lemma 3.5 is that for nN, q(n)j=0n1Uj,n={1:n}. Hence, 1q(n)n for all nN and Theorem 1.3 is proven.

We return to T. In words, Ti,n is the set of all values that q(n) attains in practice, given that f(n), as f ranges over S, is equal to i. Clearly, since f has property S0, 0i=f(n)n1. It is important to note that T is not equal to U because approximations were made in the proof of Lemma 3.5 in order to compute the values that q(nq(n1)) can assume in principle. In particular, the unions in (Equation7) are typically over more – and larger – sets Ui,n than necessary. These approximations almost always overestimate, and never underestimate Ui,n, giving a collection of sets U such that those in T are contained within the corresponding sets in U: that is Ti,nUi,n.

As stated earlier, T can be visualized as a triangular array of sets – see Figure . This was computed by brute force. For instance, the last row corresponds to n = 8 and was computed by generating all 27 sequences fS8, finding the sequences q corresponding to each and noting the different values of q(8)|f(8)=i, for 0i7. As an example, the fourth row of Figure implies that, for instance,

  • If f(4)=0, q(4) can only be 1, that is, T0,4={1}. This is obvious since the sequence f, fS4, can only be (0,0,0,0). See Lemma 3.2.

  • Now suppose that f(4)=1. In this case, the allowed sequences f are (0,0,0,1), (0,0,1,1) and (0,1,1,1). Using (Equation3) to compute q(4) in each case, we find that the first two give q(4)=2 and the third one, q(4)=3. Thus, T1,4={2,3} (cf. U1,4={2,3,4}).

Figure 1. The first eight rows of the triangular array of sets T. Here, i and n index the sets horizontally and vertically respectively, with i=0,,n1. The set of consecutive integers k,,l is written {k:l} and as {k} when l = k.

Figure 1. The first eight rows of the triangular array of sets T. Here, i and n index the sets horizontally and vertically respectively, with i=0,…,n−1. The set of consecutive integers k,…,l is written {k:l} and as {k} when l = k.

4. Examples of sequences q that are slow

In Lemma 3.2, we gave the examples f(n)=0 and f(n)=n1, both of which lead to sequences q that are slow. We are aware of three other examples, which we now present.

The first example is given in

Lemma 4.1

Iff(n)=n+24thenq(n)=n+22.

Proof.

Let q~(x)=x2+3+cosπx4for xR. Then it can easily be verified that q~(n)=n+22 for nN. Furthermore, direct calculation gives q~(x)q~(xq~(x1))=18(2x+1+cosπx)14sin(π(2x+1+cosπx)4):=f~(x).Finally, it is straightforward to check that, for nN, f~(n)=n+24 and this proves the lemma.

Remark 4.2

We have proved more here, viz. that q~(x), f~(x) as given above obey q~(x)=q~(xq~(x1))+f~(x) for all xR: a continuous solution to (Equation3). The same is true of f0(x)=0, which implies that q0(x)=1, and f1(x)=x1, which implies that q1(x)=x, both for xR – an extension of Lemma 3.2.

For the second example, define (8) δ(n):={1,n=00,otherwise,(8) for nZ. Another instance of a slow sequence q is found when f(n)=1δ(n1): in fact, Q(1δ(n1))=1,2,2,3,3,3,4,, where each positive integer k occurs k times. This sequence can also be written ForkN,q(n)=kforh(k)nh(k+1)1,withh(k):=k2k+22.We summarize these observations in the following lemma:

Lemma 4.3

Let f(n)=1δ(n1)=(0,1,1,). Then q(n)=(1,2,2,3,3,3,4,), where each positive integer appears in turn, with integer k occurring k times in succession. That is, q(n)=kforh(k)nh(k+1)1,where kN and h(k)=k2k+22.

This sequence [Citation8] is a special case of a generalized Golomb triangular recursion [Citation4]. A proof of Lemma 4.3 by S.W. Golomb can be found in the ‘Links’ section of [Citation8].

Remark 4.4

This result can also be written as f(n)=1δ(n1)q(n)=12+2n74=:w(n),as can be easily shown by considering 2h(k)7/4=k1/2 for kN. However, we lack a direct proof of Lemma 4.3 starting from this expression.

Remark 4.5

This result relates immediately to the fact that T1,nU1,n: we have explicitly constructed T1,n={2:w(n)} above, from which it is clear that T1,nU1,n for n>2. See the second column from the left in Figure .

The third example of a slow sequence q is especially interesting and involves γ, the reciprocal of the golden ratio:

Theorem 4.6

Let γ:=512, so that γ2+γ1=0. Then q(n)=1+γ(n1) obeys (Equation3) with f(n)=γ2n.

Since γ0.618<1, clearly q(n) as defined here is slow, and, furthermore, q(1)=1.

In the course of the proof of the theorem, we need a few small results:

  1. Footnote1γ2+γ=1, which implies that 2γ2+3γ=2+γ, γ1=1+γ, γ2(γ+2)=1.

  2. x=x+{x}, xR, where {x} is the fractional part of x

  3. x=x1, xZ

  4. m+x=m+x for mN

  5. {γ2n}=1{γn}.

Item (i) comes from the given definition of γ and (ii)–(iv) are from the definition of the floor function. For (v), start from (ii) with x=γ2n, which gives {γ2n}=γ2nγ2n. Now use (i) to replace γ2 with 1γ, giving {γ2n}=nγnnγn=γnγn, where (iv) has been used. Then (iii) gives {γ2n}=γn+γn+1=1{γn}, using (ii).

Proof of Theorem 4.6

We first show that the theorem is equivalent to identity (Equation9) below, then we prove the identity itself.

Starting from q(n)=1+γ(n1), clearly q(1)=1. It is convenient to shift n by 1, giving q(n+1)=1+γn, which we will show obeys (Equation3) for nN. When this is substituted in q(n+1)q(n+1q(n)) we have q(n+1)q(n+1q(n))=γnγ(n1)γγ(n1).Now, using (i), (iii) and (iv), we find that q(n+1)q(n+1q(n))=n1γ2nγ+γγ2(n1).Hence, Theorem 4.6 holds if the right-hand side of the above expression is equal to f(n+1)=γ2(n+1) for nN, that is, if (9) θ(n):=γ+γγ2(n1)+γ2n+γ2(n+1)=n1fornN.(9) To prove (Equation9), we consider separately three cases which are demarcated according to Case A:{γ2n}(0,γ2);Case B:{γ2n}(γ2,γ);Case C:{γ2n}(γ,1).For n>1, these intervals are all open because γ and γ2=(35)/2 are irrational. Hence, we first dispose of the case n = 1, where we find θ(1)=γ+0+γ2+2γ2=0=n1,since γ2<1/2.

We assume that n2 throughout the rest of this proof. Proving cases A–C for n2 amounts primarily to rearranging θ(n) into a first-degree polynomial in n, plus the floor of a bounded function of n.

Case A. Note that {γ2n}(0,γ2) implies that γ2(n1)=γ2(n)1 and γ2(n+1)=γ2(n). Thus, in case A we have θ(n)=γγ2n+2γ2n=:θA(n).Consider the first term in θA(n): γγ2n=γ(1γ)n=γnγ(γn+1)=γnγ(γn{γn}+1),where we have used (i), (iv), (iii) and then (ii). Replacing the first γn with (1γ2)n, we get γγ2n=n+2γ2n+γ{γn}γ=n12γ2nγ{γn}+γ,using (iii). We can now use (ii) and (v) to obtain γγ2n= n12(γ2n+{γ2n})+γ(1{γn})=n12(γ2n+{γ2n})+γ{γ2n}.Hence, using (iv), θA(n)=n12(γ2n+{γ2n})+γ{γ2n}+2γ2n=n1(γ+2){γ2n},and θA(n) is now in the required form.

Since 0<{γ2n}<γ2, we have, in case A, 0<(γ+2){γ2n}<γ2(γ+2)=1, using (i), and so (γ+2){γ2n}=0. Therefore, θA(n)=n1.

Case B. For case B, we have γ2<{γ2n}<γ=1γ2 and this implies that γ2(n1)=γ2n=γ2(n+1). Hence, in case B θ(n)=γ+γγ2n+2γ2n=:θB(n).Since 2γ2n is an integer, we immediately have θB(n)=γ+(γ+2)γ2n. Now, (γ+2)γ2n=(γ+2)(γ2n{γ2n})=n(γ+2){γ2n},by (ii) and (i). Hence, (10) θB(n)=n+γ(γ+2){γ2n}=n1(γ+2){γ2n}γ,(10) using (iii). Now, by the definition of case B, γ2(γ+2)<(γ+2){γ2n}<γ(γ+2)or1<(γ+2){γ2n}<γ+1.Hence, (γ+2){γ2n}γ=0 and θB(n)=n1.

Case C. Case C is similar to case B. We now have γ<{γ2n}<1, giving γ2(n1)=γ2n but γ2(n+1)=γ2n+1. Hence, in case C θ(n)=γ+γγ2n+2γ2n+1=:θC(n).From the definition of θB(n), we see immediately that θC(n)=θB(n)+1 and so, from (Equation10), we have θC(n)=n(γ+2){γ2n}γ. Hence, for case C, γ(γ+2)<(γ+2){γ2n}<(γ+2)or1<(γ+2){γ2n}γ<2.Therefore, (γ+2){γ2n}γ=1 and so θC(n)=n1, concluding the proof of the theorem.

5. Heuristic and experimental results

In this section we present heuristic plausibility arguments to give simple descriptions of the behavior of q for certain sequences f. As we shall see, computation suggests that the actual behavior of q follows our predictions closely. We consider three types of sequence f.

5.1. f(n)=αn, α(0,1)

The following lemma summarizes what we can say about the behavior of q(n) in this case.

Lemma 5.1

Let f(n)=αn with α(0,1). Assume that q(n)=an+ϵ(n), where a(0,1) is a constant, and that limnϵ(n)/n=0. Then a=α.

Proof.

Substituting q(n)=an+ϵ(n) in Equation (Equation3) gives an+ϵ(n)=a(na(n1)ϵ(n1))+ϵ(na(n1)ϵ(n1))+αn{αn},and solving for ϵ(n) gives ϵ(n)=a2(n1)(n1)+ϵ(na(n1)ϵ(n1))+αn{αn}.Dividing both sides by n and letting n gives a2=α and so (11) q(n)=αn+o(n).(11)

This turns out to be a good approximation. For an example, see Figure , which shows q(n)n/2 when f(n)=n/2. For n160000, we find from the data used to produce this figure that |q(n)n/2|<75.5.

Theorem 4.6 is a particular case of Equation (Equation11) with α=γ2.

5.2. f(n)=aforn>n

The case f(n) tends to a constant aN as n is interesting, and is a special case of a nested recursion studied in [Citation10]. We argue by proposing the ansatz q(x)=2axb, xR, and then deducing the f(x) that this implies. Starting from the asymptotic expansion: f(x)=q(x)q(xq(x1))a+2a(a2b)4x+a(a2b2)4x+O(x32),we let b=a/2 in order to eliminate the second term. This gives f(x)aa2x+O(x32).This short calculation suggests that, for a,nN, (12) f(n)=aδ1(n)q(n)=2ana/2+δ2(n),(12) where δ1(1)=a and δi(n)0 as n, i = 1, 2.

This appears to work surprisingly well – see Figure , which compares q when f(n)=55/n), so that limnf(n)=4, with s(n):=8n2 for n=1,,105. Over this range, we find that |q(n)s(n)|<2.

Figure 2. Plot of q(n), black dots, for f(n)=55/n, so that f(n)4 as n. According to the argument in Section 5.2, we expect that q(n)8n2:=s(n), this curve being plotted as a continuous black line. The approximation appears to hold remarkably well, the two plots being almost exactly superimposed. Inset: enlargement of the region 75000n80000.

Figure 2. Plot of q(n), black dots, for f(n)=⌊5−5/n⌋, so that f(n)→4 as n→∞. According to the argument in Section 5.2, we expect that q(n)∼8n−2:=s(n), this curve being plotted as a continuous black line. The approximation appears to hold remarkably well, the two plots being almost exactly superimposed. Inset: enlargement of the region 75000≤n≤80000.

Figure 3. Plot of q(n)n/2 for n=1,,160000, with f(n)=n2. Two pairs of self-similar regions a1,a2 and b1,b2 are shown – see text.

Figure 3. Plot of q(n)−n/2 for n=1,…,160000, with f(n)=⌊n2⌋. Two pairs of self-similar regions a1,a2 and b1,b2 are shown – see text.

Other examples were tried: f(n)=aaexp(bn), f(n)=aa/nb and f(n)=an if n<n0 and an0 otherwise. In all cases, a, b were chosen so as to ensure that f(n) had property S0, and every time, (Equation12) gave an excellent approximation to q(n): in these cases at least, it is the asymptotic behavior of f(n) that determines the asymptotic behavior of q(n).

5.3. f(n)=c1np1+c2np2+ with pi(0,1)

Arguing in reverse as in the previous case, we can obtain useful approximations to q(n) when f(n) is the sum of fractional powers of n, at least in certain special cases. We use the ansatz q(x)=axp+b and calculate the asymptotic expansion for f(x)=q(x)q(xq(x1))ap[bxp1+b2(1p)2xp2++ax2p1+a(b(1p)p)x2p2++a2(1p)2x3p2+a2(1p)(b(2p)2p)2x3p3+].Note that the powers of x here are pi, iN and ipj, i2, ji1. We cannot order the powers of x unless a value of p is specified. Letting, for example, a = 1, b=1/2 and p=3/4, we have f(x)=3x12/4+3x14/32+5/128+O(x14) and q(x)=x34+1/2. Then, with f(n)=3n12/4+3n14/32+5/128, which has property S0, we generate q(n) via (Equation3) and compare this with our approximation q(n):=n34+1/2. The agreement is good, with 21q(n)q(n)3 for 1nN=160000, where q(N)=7990.

5.4. Dynamics

We close this section with some figures illustrating examples of the dynamics of q for particular sequences f.

An interesting case is q=Q(n/2), shown in Figure . This shows the de-trended sequence q(n)n/2 – see (Equation11) – for 1n160000. At first sight, no obvious patterns appear in the plot, but in fact there are several regions of exact self-similarity, even in this limited range of n. Specifically, among others, we observe

  • q(i+69568)q(i)=49192fori{9235:27465} (regions a1,a2); and

  • q(i+107616)q(i)=76096fori{91:44577} (regions b1,b2).

Our final figure gives an intuitive idea of what happens if we make a small perturbation. It is tempting to describe the behavior of many of the sequences Q(f) as ‘chaotic’. However, since (Equation3) is discrete in time and space, there is no sense in which the system can be infinitesimally perturbed; perhaps the best we can do is to compute sequences q, q1, where q1 is computed identically to q – using (Equation3) in the usual way – except that we artificially adjust a single term, q(n1) say, for some small integer n1. The result of such a computation, with q=Q(n/2), q1=Q(n/2+δ(n16)), so that q1(16)=1+q(16), is shown in Figure . This figure is a plot of the difference q(n)q1(n) versus log2(n), the scaling bringing out the approximate periodicity visible on a logarithmic scale. We see regions where q(n)q1(n)=0 exactly, interspersed with regions where this difference is far from zero: the memory of the perturbation seems to persist indefinitely.

Figure 4. Plot of the difference of q(n)=Q(n/2) and q1(n)=Q(n/2+δ(n16)). The idea is that q1(n) is a slightly perturbed version of q(n). The effect of the perturbation persists, at least until n=219.

Figure 4. Plot of the difference of q(n)=Q(⌊n/2⌋) and q1(n)=Q(⌊n/2⌋+δ(n−16)). The idea is that q1(n) is a slightly perturbed version of q(n). The effect of the perturbation persists, at least until n=219.

6. Conclusions and further work

We have investigated the problem of the conditions on an integer sequence f(n), nN, with f(1)=0, such that the sequence q(n), with q(1)=1, computed from q(n)=q(nq(n1))+f(n), exists. We think of the sequence q as a solution to this difference equation. We have proved that if f(n+1)f(n){0,1}, n1, then the solution q exists, the existence of q being exactly equivalent to the inequality 1q(n)n holding for all nN.

We have defined S as the set of semi-infinite slow sequences (that is, sequences with differences between successive terms equal to 0 or 1)Footnote2. In Lemma 2.1 examples were given of sequences fS but for which q nonetheless exists – the condition that f be slow is sufficient but not necessary – and this suggests that we define a second set of semi-infinite integer sequences, F, which is the set of all sequences f with f(1)=0 such that the corresponding sequence q exists. Clearly, SF.

It would be fruitful to investigate the structure of F further. The question naturally arises as to whether the proof of Theorem 1.3 could be extended to include more sequences f. A better characterization of F might be a useful step on the way to settling the question of the existence of the Hofstadter sequence, this problem being the original motivation for our work. In fact, the question would have been settled by Theorem 1.3, were the sequence c(n):=qh(nqh(n2)), with qh defined by (Equation1), to be slow. It is not – in fact c=(1,2,2,2,3,3,3,3,3,4,5,4,5,).

Solutions arising from fS typically appear to display non-trivial dynamics: in particular, they are generally aperiodic and display no obvious patterns. For some special sequences f, for instance f(n)=αn with α[0,1), the average behavior appears to be well-defined, however, and we give a heuristic argument for this.

Less typical seem to be sequences fS for which the corresponding solution is also monotonic, and we construct exact solutions in the cases of which we are aware.

Both from the point of view of the existence of solutions and from the study of their dynamics, the difference Equation (Equation3) appears to be an interesting subject for further study, even in its own right.

Acknowledgments

The Authors would like to acknowledge helfpul discussions with Dr Peter Gallagher and the valuable comments of the anonymous referees of this journal.

Disclosure statement

No potential conflict of interest was reported by the author(s).

Notes

1 (i), (ii) etc would be clearer labels than i, ii

2 It would be useful to add  "and with first term equal to zero" here, i for consistency with the original definition of S.

References

  • B. Balamohan, A. Kuznetsov, and S. Tanny, On the behavior of a variant of Hofstadter's Q-sequence, J. Integer Seq. 10 (2007), Article 07.7.1.
  • N. Fox, Quasipolynomial solutions to the Hofstadter Q-recurrence, Integers 16 (2016), paper A68, 6 pp.
  • D.R. Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid, Basic Books, Springer, New York, 1979. ISBN 0-465-026850.
  • A. Isgur, V. Kuznetsov, and S.M. Tanny, A combinatorial approach for solving certain nested recursions with non-slow solutions, J. Differ. Equ. Appl. 19(4) (2013), pp. 604–615. https://doi.org/10.1080/10236198.2012.662967.
  • OEIS Foundation Inc., Entry A005185 in the On-Line Encyclopedia of Integer Sequences, 2024; Available at https://oeis.org/A005185 (in particular the reference to a computation by M. Eric Carr (2 July 2023)).
  • OEIS Foundation Inc., Entry A006949 in the On-Line Encyclopedia of Integer Sequences, 2024; Available at https://oeis.org/A006949.
  • OEIS Foundation Inc., Entry A063882 in the On-Line Encyclopedia of Integer Sequences, 2024; Available at https://oeis.org/A063882.
  • OEIS Foundation Inc., Entry A002024 in the On-Line Encyclopedia of Integer Sequences, 2024; Available at https://oeis.org/A002024.
  • K. Pinn, Order and chaos in Hofstadter's Q(n) sequence, Complexity 4(3) (1999), pp. 41–46.
  • M. Sunohara and S.M. Tanny, On the solution space of the Golomb recursion, J. Differ. Equ. Appl. 24(8) (2018), pp. 1273–1294. https://doi.org/10.1080/10236198.2018.1471471.
  • S.M. Tanny, A well-behaved cousin of the Hofstadter sequence, Discrete Math. 105(1–3) (1992), pp. 227–239.