The Membership Problem for Hypergeometric Sequences with Quadratic Parameters

Hypergeometric sequences are rational-valued sequences that satisfy first-order linear recurrence relations with polynomial coefficients; that is, a hypergeometric sequence $\langle u_n \rangle_{n=0}^{\infty}$ is one that satisfies a recurrence of the form $f(n)u_n = g(n)u_{n-1}$ where $f,g \in \mathbb{Z}[x]$. In this paper, we consider the Membership Problem for hypergeometric sequences: given a hypergeometric sequence $\langle u_n \rangle_{n=0}^{\infty}$ and a target value $t\in \mathbb{Q}$, determine whether $u_n=t$ for some index $n$. We establish decidability of the Membership Problem under the assumption that either (i) $f$ and $g$ have distinct splitting fields or (ii) $f$ and $g$ are monic polynomials that both split over a quadratic extension of $\mathbb{Q}$. Our results are based on an analysis of the prime divisors of polynomial sequences $\langle f(n) \rangle_{n=1}^\infty$ and $\langle g(n) \rangle_{n=1}^\infty$ appearing in the recurrence relation.


Introduction
Background and Motivation.Recursively defined sequences are ubiquitous in mathematics and computer science.A fundamental open problem in this context is the decidability of the Membership Problem, which asks to determine whether a given value is an element of a given sequence.The Skolem Problem for C-finite sequences (those sequences that satisfy a linear recurrence relation with constant coefficients) is the best known variant of the Membership Problem.The Skolem Problem asks to determine whether a given C-finite sequence vanishes at some index [4].Decidability of this problem is known for recurrences of order at most four [17,26] but is open in general.Proving decidability of the Skolem Problem would be equivalent to giving an effective proof of the celebrated Skolem-Mahler-Lech Theorem, which states that every non-degenerate C-finite sequence that is not identically zero has a finite set of zeros.
In this paper we consider the most basic case of the Membership Problem for a class of P-finite sequences (those sequences that satisfy a linear recurrence with polynomial coefficients).Specifically, we consider the Membership Problem for the class of hypergeometric sequences.A rational-valued sequence ⟨u n ⟩ ∞ n=0 is hypergeometric if it satisfies a recurrence relation of the form where f, g ∈ Z[x] are polynomials, and f (x) has no non-negative integer zeros.By the latter assumption on f (x), the recurrence relation (1) uniquely defines an infinite sequence of rational numbers once the initial value u 0 ∈ Q is specified.The term hypergeometric was introduced by John Wallis in the 17th century [27] and hypergeometric sequences and their associated generating functions, the hypergeometric series, have a long and illustrious history in the mathematics literature.In particular, hypergeometric series encompass many of the common mathematical functions and have numerous applications in analytic combinatorics [5,10].
The Membership Problem for hypergeometric sequences asks, given a recurrence (1), initial value u 0 ∈ Q, and target t ∈ Q, whether t lies in the sequence ⟨u n ⟩ ∞ n=0 .At first glance, this problem may seem easy to decide.Without loss of generality we can assume that the sequence ⟨u n ⟩ ∞ n=0 either diverges to infinity or converges to a finite limit.If the sequence does not converge to t then one can compute a bound B such that u n ̸ = t for all n > B. Such a bound can also be computed in case one is promised that ⟨u n ⟩ ∞ n=0 converges to t, by using the fact that the convergence to t is ultimately monotonic.However the above case distinction does not suffice to show decidability of the Membership Problem!The problem is that it is not known how to decide whether a hypergeometric seqeuence converges to a given rational limit.The latter is related to deep conjectures about the gamma function (see the discussion below).In this paper we will take a different route to establish decidability of certain cases of the Membership Problem.
Contributions.We approach the Membership Problem by considering the prime divisors of the values of a hypergeometric sequence ⟨u n ⟩ ∞ n=0 .The overall strategy is to exhibit an effective threshold B such that for all n > B there is a prime divisor of u n that is not a divisor of the target t.Our two main contributions are as follows: • The Membership Problem for hypergeometric sequences whose polynomial coefficients (as in ( 1)) have distinct splitting fields is decidable (Theorem 11).• The Membership Problem for hypergeometric sequences whose polynomial coefficients are monic and split over a quadratic field is decidable (Theorem 13).The proofs of our main results involve two different implementations of our general strategy.The proof of Theorem 11 applies the Chebotarev density theorem to find a single prime p ∈ Z that does not divide the target t but divides all members of an infinite tail of the sequence.Meanwhile, the proof of Theorem 13 shows that for all sufficiently large n there exists a prime p, that is allowed to depend on n, such that p divides u n but not t.To find such a prime we rely on (a mild generalisation of) a result of [3] concerning prime divisors of the values of a quadratic polynomial.
Theorem 11 expands the class of sequences for which the Membership Problem can be solved and further isolates its hard instances.The paper [22] handles perhaps the easiest sub-case of the Membership Problem that does not fall under Theorem 11, namely when the polynomial coefficients both split over Q.The second main result of the present paper handles another naturally occurring sub-case: when the polynomial coefficients split over the ring of integers of a quadratic field K.A common refinement of these two cases-that the polynomial coefficients split over K-is the subject of current research.Generalisations of the results of [3] to higher-degree polynomials are a subject of ongoing research in number theory and potentially would allow us to extend our approach beyond the quadratic case.
Related Work.There is a growing body of work that addresses membership and threshold problems for sequences satisfying low-order polynomial recurrences.Here the Threshold Problem asks to determine whether every term in a sequence lies above a given threshold, for example, whether every term is non-negative.
The recent preprint [12] establishes decidability results (some conditional on Schanuel's Conjecture) for both the Membership and Threshold Problems for hypergeometric sequences.The approach of [12] relies on transcendence theory for the gamma function (as well as underlying properties of modular functions established by Nesterenko [19]).By contrast, the algebraic techniques of the present paper seem appropriate only for the Membership Problem.We note that the approach of [12] requires certain restrictions, e.g., decidability is only unconditional when the parameters are drawn from imaginary quadratic fields.
The problem of deciding positivity of order-two P-finite sequences and of deciding the existence of zeros in such sequences is considered in [11,14,21,23].These works all place syntactic restrictions on the degrees of the polynomial coefficients involved in the recurrences, and all four give algorithms that are not guaranteed to terminate for all initial values of a given recurrence.For example, in [11] the termination proof of the algorithm for determining positivity of order-two sequences requires that the characteristic roots of the recurrence be distinct and that one is working with a generic solution of the recurrence (in which the asymptotic rate of growth corresponds to the dominant characteristic root of the recurrence).Simple manipulations show that the Membership Problem considered in this paper is equivalent to the problem of finding a zero term in an order-two P-finite sequence ⟨u n ⟩ ∞ n=0 arising as a sum of two hypergeometric sequences.Links between the Membership and Threshold Problems and the Rohrlich-Lang Conjecture appear in previous works [13,22].Here the Rohrlich-Lang Conjecture concerns multiplicative relations for the gamma function evaluated at rational points.
The p-adic techniques used in the present paper bear many similarities with work on developing criteria for hypergeometric sequences to be integer valued.For example, work by Landau in 1900 [15] uses p-adic analysis to establish a necessary and sufficient condition for integrality in the so-called class of factorial hypergeometric sequences.In more recent work, Hong and Wang [9] establish a criterion for the integrality of hypergeometric series with parameters from quadratic fields.We observe that some of the intermediate asymptotic results in Hong and Wang's note are close to [1, Corollary 3.1] (Proposition 4 herein).
Structure.The remainder of this paper is structured as follows.We briefly review preliminary material in Section 2, including some standard assumptions about instances of the Membership Problem that can be made without loss of generality.In Section 3, we recall useful technical results on the prime divisors of hypergeometric sequences that satisfy monic recurrence relations (see (2)).In Section 4, we prove Theorem 11.The proof of Theorem 13 is given in Section 5. We discuss ideas for future research in Section 6.The remaining appendices prove technical results omitted from the main text.

Preliminaries
Hypergeometric Sequences.A hypergeometric sequence ⟨u n ⟩ ∞ n=0 is a sequence of rational numbers that satisfies a recurrence of the form (1) where f, g ∈ Z[x] are polynomials, and f (x) has no non-negative integer zeros.By the latter requirement on f (x), the recurrence (1) uniquely defines an infinite sequence of rational numbers once the initial element u 0 is specified.
An instance of the Membership Problem for hypergeometric sequences consists of a recurrence (1), an initial value u 0 ∈ Q, and a target t ∈ Q.The problem asks to decide whether there exists n ∈ N such that u n = t.We say that such an instance is in standard form if (S1) the initial condition is u 0 = 1; (S2) the polynomial g(x) has no positive integer root; (S3) the target t is non-zero; (S4) the polynomials f and g have the same degree and leading coefficient.
For the purposes of deciding the Membership Problem, we can assume without loss of generality that all instances are in standard form.An arbitrary instance can be transformed into one satisfying Condition (S1) by multiplying the sequence and target by a suitable constant.Instances of the Membership Problem that fail to satisfy Conditions (S2) and (S3) are trivially solvable.The positive integer roots of g can be computed and for any such root n 0 , we have u n = 0 for all n ≥ n 0 .Finally, for recurrences that fail Condition (S4) we have that n) either converges to 0 or diverges in absolute value.Under the assumption that t ̸ = 0, in each case we can compute an effective threshold n 0 such that u n ̸ = t for all n ≥ n 0 .
The p-adic valuation.Let p ∈ N be a prime.Denote by v p : Q → Z ∪ {∞} the p-adic valuation on Q. Recall that for a non-zero number x ∈ Q, v p (x) is the unique integer such that x can be written in the form x = p vp(x) a b where a, b ∈ Z and p divides neither a nor b.The value v p (0) is defined to be ∞.

The valuation possesses two important properties:
- Asymptotic estimates for series over primes.Given ∼ ∈ {<, =, >} and x ∈ Q, we denote sums over primes p ∈ N such that p ∼ x by p∼x .Let π(x) := p≤x 1 count the number of primes of size at most x.The following result is a consequence of the celebrated Prime Number Theorem.
Theorem 1.For π(x) as above, we have As an aside, an element a ∈ Z is a square modulo a prime p ∈ N if there exists an x ∈ Z such that x 2 ≡ a (mod p).An element a ∈ Z is a quadratic residue modulo p if a is both a square modulo p, and furthermore a and p are co-prime.We denote by L p the set of quadratic residues modulo p.
Recall the first of Mertens' three theorems [16] (see also [2,Theorem 4.10]), In the sequel we shall make use of the following refinement of Mertens' theorem.
Proposition 2. Suppose that a ∈ Z is not a perfect square.Then p≤x, a∈Lp .
Proposition 2 appears in work by Selberg [24,Equation (3.3)] on an elementary proof of Dirichlet's theorem in arithmetic progressions.

Monic Recurrences
In this section, we study hypergeometric sequences ⟨u n ⟩ ∞ n=0 , satisfying first-order recurrences of the special form where f ∈ Z[x] has no non-negative integer roots.We call such a recurrence monic.
We analyse the prime divisors of sequences ⟨u n ⟩ ∞ n=0 that satisfy such a monic recurrence.In particular, we recall two results that will serve as stepping stones toward our main decidability theorems in the subsequent sections.Following [1], for a fixed prime p, the first result establishes an asymptotic estimate for the p-adic valuation v p (u n ) as n tends to infinity.Next, following [3], when f is a quadratic polynomial we prove a result that yields asymptotic estimates on the size of the largest prime divisors of u n as n tends to infinity.The restriction on the degree is necessary given the state of the art: estimates on large prime divisors constitute hard open problems in the theory of polynomials [8,7].
3.1.Asymptotic growth of valuations.Let p ∈ N be prime.Consider a hypergeometric sequence ⟨u n ⟩ ∞ n=0 , satisfying a monic recurrence (2).Since In this section we recall the result of [1] that characterises the asymptotic growth of v p (u n ) in terms of the number of roots of f in Z/pZ.The key tool in this argument is Hensel's Lemma.
Then for all e > 0 there exist polynomials Define a Hensel prime for f ∈ Z[x] to be a prime that does not divide the discriminant of any irreducible factor of f .Since the discriminant of an irreducible polynomial is non-zero, all but finitely many primes are Hensel primes for a given polynomial.
Given a prime p, suppose that f ∈ Z[x] has m roots in Z/pZ, i.e., suppose that f factors as where α 1 , . . ., α ℓ ∈ Z, g ∈ Z[x] has no root modulo p, and m = m 1 + • • • + m ℓ .In this case, if p is a Hensel prime for f then for all e > 0 we can apply Hensel's Lemma to obtain a factorisation where β 1 , . . ., β ℓ ∈ Z, and h ∈ Z[x] has no root modulo p.In other words, f has exactly m roots in the ring Z/p e Z.
The following result is a reformulation of [1, Corollary 3.1].For later use, we formulate the result so as to make explicit the dependence of the bounds for v p (u n ) on the prime p.The proof remains the same.
Let p be a Hensel prime of f such that f has m roots modulo p. Then there exist effectively computable constants ε, n where ε depends only on f .
Proof.The function |f (x)| is eventually monotonically increasing on N.There exists an effectively computable bound n 0 such that for all n ≥ n 0 and all 1 Furthermore, there exists an effective constant ε 0 > 0, independent of p, such that for all n ≥ n 0 and all 1 ≤ k ≤ n we have Fix n ≥ n 0 and define e max to be the smallest power of p such that Since p is a Hensel prime, by Hensel's Lemma, there is a factorisation where Now for all 1 ≤ e ≤ e max the set {k ∈ N : p e | k − β i } is an arithmetic progression with common difference p e and so Combining inequality (5) with Equation ( 4) we obtain Let ε := ε 0 + 1.The desired result follows by sandwiching the term . We assume that −β is not a perfect square, which is equivalent to assuming that f is irreducible.Let a, b ∈ Q be such that 0 ≤ a < b.Let c, d ∈ N.For all n ∈ N we define and Informally speaking, the following theorem gives effective super-linear lower bounds on the growth of the function that maps n to the greatest prime divisor of F n .The result itself and the proof are a slight generalisation of [3,Theorem 5.1].The main difference is that we permit I(n) to be the intersection of an interval and an arithmetic progression, whereas the work cited above considers unrefined intervals I(n) = {1, . . ., n}.
Theorem 5. Let M ∈ N.There exists an effectively computable bound B ∈ N such that for all n > B there exists a prime p > M n that divides F n .
Proof.Given n ∈ N, we have the prime factorisation F n = p p ep where e p := v p (F n ) for each prime p.Note that e p = 0 for all but finitely many p.Taking logarithms, we get log(F n ) = p e p log p.
Partitioning the above sum into a sub-sum over primes at most M n and a sub-sum over primes greater than M n, we obtain The theorem at hand follows from a lower bound on the sum p>M n e p log p on the left-hand side of (7).To this end we have two sub-goals: give a lower bound on log(F n ) and an upper bound on p≤M n e p log p.
Write A := b−a c .The following lower bound on log(F n ) is a consequence of Stirling's formula.The proof is in Appendix A. Claim 6.We have the bound log(F n ) ≥ 2A(n log n − n).
The next task is give an upper bound on p≤M n e p log p.Here we follow the approach in [3] and further partition the sum into those primes p < n (treated in Claim 7) and those primes n ≤ p ≤ M n (treated in Claim 8).
Claim 7.There exist positive constants ε, n 0 > 0 such that if n > n 0 , then p<n e p log p ≤ An log n + εn.
Proof.Let S n be the set of primes p < n such that p divides F n and p is a Hensel prime for f .Observe that p<n e p log p − p∈Sn e p log p ≤ ε 0 log n for an effective constant ε 0 .Indeed, if p < n is a prime divisor of F n that does not lie in S n then p divides the discriminant of f -and there are finitely many such primes.Thus to prove the claim it will suffice to show the following bound for some effective constant ε 1 : For p ∈ S n , we establish an upper bound on e p which follows from Proposition 4: Here the constant ε 2 is effective and independent of the prime p.The justification is given in Appendix A. We next argue that there exist effective constants ε 3 , ε 4 , n 1 > 0 such that the following chain of inequalities is valid for all n ≥ n 1 .We have that p∈Sn e p log p ≤ No prime in S n divides the discriminant of f .Since the latter is equal to −4β, no prime in S n divides β.In addition, every prime in S n is a divisor of F n ; i.e., a divisor of k 2 + β for some k ∈ I(n), we have that β is a quadratic residue modulo p for every prime p ∈ S n .Thus, for sufficiently large n, we have that (by Proposition 2) for some effective constant ε 5 .
Proof.Let n ∈ N. Suppose that p > (b − a)n is a prime divisor of F n .For such primes, we shall first show that e p := v p (F n ) ≤ 2. Assume, for a contradiction, that there are distinct integers The desired result follows from the estimate on π(x) given by the Prime Number Theorem (Theorem 1).□ We return to the proof of Theorem 5. From Equation ( 7), Claim 7, and Claim 8, there exist positive constants ε, n 0 > 0 such that if n > n 0 then p>M n e p log p ≥ An log n − εn.
In turn, the above lower bound entails that for sufficiently large n, there exist prime divisors p | F n such that p > M n.This concludes the proof.□

Decidability: different splitting fields
In this section we show decidability of the Membership Problem for recurrence sequences that satisfy a first-order relation of the form (1) subject to the condition that the polynomial coefficients f, g ∈ Z[x] have different splitting fields.To this end, it is useful to introduce the following terminology.Let p be a Hensel prime for f g.We say that the recurrence (1) is p-symmetric if the two polynomials f and g have the same number of roots in Z/pZ.Otherwise we say that the recurrence is p-asymmetric.
We first show decidability of the Membership Problem in the case of p-asymmetric recurrences and then we apply the Chebotarev Density Theorem to show that every recurrence in which f and g have different splitting fields is p-asymmetric for infinitely many primes p. Lemma 9.There is a procedure to decide the Membership Problem for the class of hypergeometric sequences whose defining recurrences are p-asymmetric for some prime p.
Proof.Suppose that the hypergeometric sequence ⟨u n ⟩ ∞ n=0 satisfies the recurrence (1) and moreover that there is a prime p with respect to which the recurrence is pasymmetric.We want to decide whether such a sequence reaches a given target value t.
Consider the sequences ⟨x n ⟩ ∞ n=0 and ⟨y n ⟩ ∞ n=0 respectively defined by the monic recurrences x n = g(n)x n−1 , y n = f (n)y n−1 , with x 0 = y 0 = 1.Then u n = xn yn and hence, for the aforementioned prime p, by the multiplicative property.
Recall that p is, by definition, a Hensel prime for both f and g.Hence, by Proposition 4, we obtain an asymptotic estimate of the form where m f is the number of roots of f modulo p and m g is defined similarly.Here the implied constant depends on f g and p.The proof concludes by noting that v p (t) is a constant, whereas v p (u n ) is bounded away from v p (t) for sufficiently large n (note this threshold is computable).We deduce that u n ̸ = t, again, for sufficiently large n, from which the desired result follows. □ We now give a sufficient condition for a recurrence to be p-asymmetric.We use the following consequence of the Chebotarev Density Theorem.Let K be a Galois field of degree d over Q, and denote by O its ring of integers.Let Spl(K) be the set of rational primes p such that the ideal pO totally splits in O, i.e., such that pO = p 1 • • • p d where the p i are distinct prime ideals.The following result appears as [18,Corollary 8.39] and [20,Corollary 13.10].The latter reference attributes the result to Bauer.Theorem 10.Let K and L be Galois extensions of Q such that K ̸ = L. Then Spl(K) and Spl(L) differ in infinitely many primes.
We state the main theorem of this section.
Theorem 11.There is a procedure to decide the Membership Problem for the class of hypergeometric recurrences (1) whose polynomial coefficients have different splitting fields.
Proof of Theorem 11.Let ⟨u n ⟩ ∞ n=0 satisfy a recurrence (1) for which the coefficients f and g have respective splitting fields K and L, with K ̸ = L. Recall that there are only finitely many primes that are not Hensel primes for f g.By Theorem 10, there exists a Hensel prime for f g that lies in exacly one of the two sets Spl(K) and Spl(L).For such a prime p, the recurrence ( 1) is p-asymmetric.Hence the result follows from Lemma 9. □ We note that the recurrence (1) can be p-asymmetric even when f and g have the same splitting field.We demonstrate this phenomenon with the following example.
It is straightforward to verify that 7 is a Hensel prime for f g by noting that it does not divide the discriminants of the respective irreducible factors of f and g.To show that the recurrence is 7-asymmetric, observe first that f factors as (x + 4)(x + 3)(x 2 + 1) over Z/7Z, where x 2 + 1 is irreducible; thus f has two roots in Z/7Z.On the other hand, g factors into a pair of irreducible quadratic polynomials over Z/7Z and hence has no roots.
We can now follow the argumentation of Lemma 9 to decide the Membership Problem for ⟨u n ⟩ ∞ n=0 with respect to any given target t ∈ Q.Consider the monic recurrences To obtain bounds on v 7 (y n ), note that |f (k)| ≤ n 4 for all n ≥ 2 and 1 ≤ k ≤ n.Proposition 4 gives the inequality For any target t ∈ Q, the above bound allows us to compute a threshold B such that for all n > B we have Since and hence u n ̸ = t.

Decidability: quadratic splitting fields
In this section, we focus on the decidability of the Membership Problem for recurrences in which both f, g ∈ Z[x] are monic and split completely over a quadratic (degreetwo) extension K of Q.
Recall that a number field K is quadratic if and only if there is a square-free integer The assumption that f and g are both monic ensures that the roots of both polynomials are algebraic integers in Q(sqrtβ).As shown in [25,Chapter 3], the following holds.
Theorem 12. Suppose that β ∈ Z is square-free.Then the ring of algebraic integers in Q( √ β) has the form Z[θ], where The main result of the section is as follows.
Theorem 13.The Membership Problem for recurrences of the form (1) is decidable under the assumption that f, g are both monic and both split over a quadratic extension K of Q.
The proof of Theorem 13 is given in Sections 5.1 to 5.4.The details differ slightly according to the two cases for the generator θ of the ring of integers of K, as presented in Theorem 12.In the subsections below, we treat the case for θ = The necessary adjustments for the case θ = √ β are given in Appendix B. Henceforth we assume a normalised instance of the Membership Problem, given by the recurrence (1) and target t ∈ Q.Our goal is to exhibit an effective bound B such that u n ̸ = t for all n > B. To this end, our strategy is to find B such that for all n > B there exists a prime that divides u n but not t.At the conclusion of the proof of Theorem 13, we demonstrate the argument and techniques with a worked example, namely Example 2 in Section 5.4.
Let β ≡ 1 (mod 4) be a square-free integer and K = Q( √ β) a quadratic field over which the polynomials f and g in (1) split completely.Let θ := for the minimal polynomial of θ.

5.1.
Partitioning the roots of f g.Let R be the set of roots of f g.We partition R into disjoint subsets (which we shall call the classes of R) with α, α ∈ R in the same class if and only if α − α ∈ Z.We say that a subset of S ⊆ R is balanced if f and g have the same number of roots in S, counting repeated roots according to their multiplicity.A subset is unbalanced otherwise.The linchpin of the proof of Theorem 13 is the balance of roots in the classes.
If each class (as above) is balanced then the roots of f and g can be placed in a bijection under which corresponding roots differ by an integer and have the same multiplicity in f and g respectively.In this case, by cancelling common factors in the expression f (k) , we see that for n sufficiently large u n is a rational function in n.For such an instance, the Membership Problem reduces to the problem of deciding whether a univariate polynomial with rational integer coefficients has a positive integer root, which is straightforwardly decidable.A detailed account for this argument is given in [22,Appendix B].
Let us now consider the case where there is an unbalanced class C. By the assumption that f and g have the same degree, there must, in fact, be at least two unbalanced classes.It follows that there is an unbalanced class that is not contained in Z (i.e., an unbalanced class of quadratic integers).
Here it is convenient to define the following linear ordering on R. Given elements aθ + b and a ′ θ + b ′ in R (where a, a ′ , b, b ′ ∈ Z), define aθ + b ≺ a ′ θ + b ′ if and only if one of the following four mutually exclusive conditions holds: (1) a ′ ≤ 0 < a, (2) 0 < a < a ′ , (3) a < a ′ ≤ 0, images of some balanced classes φ(C0) Figure 1.Image of φ on Z as well as the positions of constants used in the proof of Theorem 12 to determine that v p (u k ) ̸ = 0 for k that satisfy a 0 θ ′ + 1 3 θ ′ ≤ k ≤ a 0 θ ′ + 2 3 θ ′ .Note that the preimages α ∈ R such that 1 ≤ φ(α) ≤ n are precisely those roots for which α ≼ α 0 .
(4) a = a ′ and b < b ′ .Note that the classes in R are intervals with respect to the order ≺.Thus the order lifts naturally to a linear order on classes.In particular, the least unbalanced class C 0 is well-defined.Let α 0 = a 0 θ + b 0 be the greatest element in C 0 .Then {α ∈ R : α ≼ α 0 } is unbalanced because this set is a disjoint union of balanced classes and C 0 .Further, a 0 > 0 because the least unbalanced class is necessarily a subset of quadratic integers of the form a 0 θ + Z.Here we note that the image of an unbalanced class under the automorphism of K that interchanges √ β and − √ β is likewise an unbalanced class and so a 0 > 0. 5.2.Threshold conditions.Next we exhibit a threshold B (defined in terms of the recurrence (1)) such that for all n > B there are rational integers θ ′ and p, with p > n prime, satisfying the following conditions: (P1) m θ (θ ′ ) ≡ 0 (mod p); (P2) The function φ : R → Z defined by is an order embedding of (R, ≺) in ({0, 1, . . ., p − 1}, <).(P3) The set {α ∈ R : 1 ≤ φ(α) ≤ n} is unbalanced.The definitions for θ ′ and p follow.Consider the interval and let M be an upper bound on {|a|, |b| : aθ + b ∈ R}, and the height of the minimal polynomials of the elements of R. By Theorem 5, there is an effective threshold B, which we may assume to be greater than 3M (M + 1), such that for all n > B there exists a prime p > 3M n that divides the product Furthermore, since p is prime, we deduce that there exists k 0 ∈ I(n) ∩ (2N + 1) such that k 2 0 ≡ β (mod p).We define θ ′ ∈ N to be the number such that k 0 = 2θ ′ + 1.We will show that θ ′ and p satisfy Conditions (P1)-(P3).Now Thus θ ′ satisfies Condition (P1).We turn next to establishing Condition (P2).Since k 0 ∈ I(n) and k 0 = 2θ ′ + 1, we have Combining (12) with the inequality 1 ≤ a 0 ≤ M and rearranging terms gives The inequality θ ′ ≤ p 4M in (13) implies that for all roots aθ + b ∈ R, φ(aθ + b) is equal to (for the latter, recall that R contains no positive integers).Further, since |b| ≤ M < θ ′ for all aθ + b ∈ R, we conclude that φ is an order embedding of (R, ≺) into ({0, . . ., p − 1}, <).This establishes (P2).Equation ( 12) and the inequality θ ′ ≤ 3M from (13) yields Hence φ(α 0 ), the image of the greatest element in C 0 is upper bounded by n.From the definition of the order (R, ≼), for α ∈ R we have that α ≼ α 0 if and only if φ(α) ≤ n.Thus (P3) follows from the fact that the set {α ∈ R : α ≼ α 0 } is unbalanced.Condition (P2) entails that ψ and φ agree on R, while Condition (P1) entails that ψ is a ring homomorphism.(We note in passing that the kernel of ψ is a prime ideal p appearing in prime ideal factorisation of pZ[θ].)Hence the polynomial f g splits over Z/pZ and φ maps the roots of f g in K to roots of f g in Z/pZ.Consider the decomposition of the p-adic valuation Let h(x) be an irreducible factor of either f or g.Then h(x) is monic, of degree at most 2 and height at most M .Since p > 3M n, we easily see that |h(k)| < p 2 for all 1 ≤ k ≤ n and hence v p (h(k)) ∈ {0, 1}.It follows that v p (u n ) is equal to the number of roots of g in Z/pZ that lie in {1, . . ., n} minus the number of roots of f in Z/pZ that lie in {1, . . ., n}, counting repeated roots according to their multiplicity.Observe that this count takes place on the set {α ∈ R : 1 ≤ φ(α) ≤ n}.By Condition (P3), the aforementioned set is unbalanced and so it quickly follows that v p (u n ) ̸ = 0. 5.4.Concluding the proof of Theorem 13.Finally, let us return to the decidability of the Membership Problem in the setting of Theorem 13.By our standing assumption that all instances of the problem are normalised we have that t ̸ = 0. We have exhibited a bound B such that for all n > B there exists a prime p > 3M n such that v p (u n ) ̸ = 0.This means that if p 0 is the largest prime such that v p0 (t) ̸ = 0 then for n > max B, p0 3M we have u n ̸ = t.Thus we have reduced the Membership Problem in this setting to a finite search problem.This immediately establishes decidability and concludes our proof of Theorem 13.
We illustrate the construction underlying Theorem 13 with a worked example.Write p 0 for the largest prime such that v p0 (t) ̸ = 0.By Theorem 5, there is a bound B > 3M (M + 1) such that for all n > max(B, p0 3M ), there is a prime p with v p (u n ) ̸ = v p (t).This permits us to reduce the Membership Problem for ⟨u n ⟩ ∞ n=0 and t to a finite search problem.
Given a target t and sufficiently large n, the process in the proof of Theorem 13 finds a prime p with v p (u n ) ̸ = v p (t). Below we illustrate the idea of the proof in the specific case t = 11 59 and n = 61.(Here we have p 0 = 59 and hence n > 3M (M + 1) and n > p0 3M , as required in the proof of Theorem 13.)We will establish the existence of a prime p such that v p (u 61 ) ̸ = 0 and v p (t) = 0, witnessing that u 61 ̸ = t.
Guided by the proof of Theorem 5, we observe that prime p := 1481 > 3nM is a divisor of It follows that v p (u 61 ) = −1, while v p (t) = 0.

Discussion
In light of the results in Section 4 a clear direction for further research is to examine the decidability of the Membership Problem for recurrences whose polynomial coefficients share the same splitting field.We recall that previous work [22] established decidability when the polynomial coefficients split over the rationals.The present work considers the case when the two polynomials split over the ring of integers of a quadratic field.In future work we will consider the more general case in which the all roots of the coefficient polynomials have degree at most two.As far as the authors are aware, the only known results in this direction are the (un)conditional decidability results for quadratic parameters in [12].Extending the approach of the present paper to the case of polynomials with roots of degree more than two would require new results on large prime divisors on the values of such polynomials, which is an active area of research in number theory.
The remaining part of the proof for the case β ≡ 1 (mod 4), as given in Subsection 5.3 and Subsection 5.4, carries over to the present case without change.

e
p log p = log(F n ) − p≤M n e p log p.
However, this leads to a contradiction since p ≥ (b − a)n ≥ k 3 − k 1 .Hence for each prime divisor p | F n with p ≥ (b − a)n, we find that e p = v p (F n ) ≤ 2. Thus we bound the summation in the statement of the claim by n<p≤M n e p log p ≤ p≤M n 2 log p ≤ 2 log(M n)π(M n).
Asymptotic estimate for the largest prime divisor.Fix a polynomial f (x) :