On the discriminator of Lucas sequences

We consider the family of Lucas sequences uniquely determined by $U_{n+2}(k)=(4k+2)U_{n+1}(k) -U_n(k),$ with initial values $U_0(k)=0$ and $U_1(k)=1$ and $k\ge 1$ an arbitrary integer. For any integer $n\ge 1$ the discriminator function $\mathcal{D}_k(n)$ of $U_n(k)$ is defined as the smallest integer $m$ such that $U_0(k),U_1(k),\ldots,U_{n-1}(k)$ are pairwise incongruent modulo $m$. Numerical work of Shallit on $\mathcal{D}_k(n)$ suggests that it has a relatively simple characterization. In this paper we will prove that this is indeed the case by showing that for every $k\ge 1$ there is a constant $n_k$ such that ${\mathcal D}_{k}(n)$ has a simple characterization for every $n\ge n_k$. The case $k=1$ turns out to be fundamentally different from the case $k>1$.


Introduction
The discriminator of a sequence a = {a n } n≥1 of distinct integers is the sequence given by D a (n) = min{m : a 0 , . . . , a n−1 are pairwise distinct modulo m}.
In other words, D a (n) is the smallest integer m that allows one to discriminate (tell apart) the integers a 0 , . . . , a n−1 on reducing modulo m.

Put
D a = {D a (n) : n ≥ 1}. The main problem is to give an easy description or characterization of the discriminator (in many cases such a characterization does not seem to exist). The discriminator was named and introduced by Arnold, Benkoski and Mc-Cabe in [1]. They considered the sequence u with terms u j = j 2 . Meanwhile the case where u j = f (j) with f a polynomial has been well-studied, see, for example, [3,7,8,13]. The most general result in this direction is due to Zieve [13], who improved on an earlier result by Moree [7].
In this paper we study the discriminator problem for Lucas sequences (for a basic account of Lucas sequences see, for example, Ribenboim [11, 2.IV]). Our main results are Theorem 1 (k = 1) and Theorem 3 (k > 2). Taken together with Theorem 2 (k = 2) they evaluate the discriminator for the infinite family of second-order recurrences (1) with for each k at most finitely many not covered values.
All members in the family (1) have a characteristic equation that is irreducible over the rationals. Very recently, Ciolan and Moree [5] determined the discriminator for another infinite family, this time with all members having a reducible characteristic equation. For every prime q ≥ 7 they computed the discriminator of the sequence u q (j) = 3 j − q(−1) j+(q−1)/2 4 , j = 1, 2, 3, . . .
that was first considered in this context by Jerzy Browkin. The case q = 5 was earlier dealt with by Moree and Zumalacárregui [9], who showed that, for this value of q, the smallest positive integer m discriminating u q (1), . . . , u q (n) modulo m equals min{2 e , 5 f }, where e is the smallest integer such that 2 e ≥ n and f is the smallest integer such that 5 f ≥ 5n/4. Despite structural similarities between the present paper and [5] (for example the index of appearance z in the present paper plays the same role as the period ρ in [5]), there are also many differences. For example, Ciolan and Moree have to work much harder to exclude small prime numbers as discriminator values. This is related to the sequence of good discriminator candidate values in that case being much sparser, namely being O(log x) for the values ≤ x, versus ≫ log 2 x. In our case one has to work with elements and ideals in quadratic number fields, whereas in [5] in the proof of the main result the realm of the rationals is never left.
Thus the situation is more weird than Shallit expected and this is confirmed by Theorem 1.
As usual, by {x} the fractional part of the real number x is denoted. Note that {x} = x − ⌊x⌋. Theorem 1. Let v n be the smallest power of two such that v n ≥ n. Let w n be the smallest integer of the form 2 a 5 b satisfying 2 a 5 b ≥ 5n/3 with a, b ≥ 1. 6,9,12,15,18,21, . . .}.
We have In contrast to the case k = 1, the case k = 2 turns out to be especially easy.
Our second main result shows that the behavior of the discriminator D k with k > 2 is very different from that of D 1 .

Theorem 3. Put
Let k > 2. We have with equality if the interval [n, 3n/2) contains an integer m ∈ A k ∪ B k and with at most finitely many n for which strict inequality holds. Furthermore, we have D k (n) = n if and only if n ∈ A k ∪ B k .
Remark 1. The condition on the interval [n, 3n/2) is sufficient, but not always necessary. The proof also works for k = 2 in which case the interval becomes [n, 5n/3). However, we prefer to give a short proof from scratch of Theorem 2 (in Section 6.1).
Theorems 2 and 3 taken together have the following corollary.
Note that A 1 = {1}, B 1 = {2 e : e ≥ 1} and that by Theorem 1 identity (2) holds true with F 1 = {2 a · 5 m : a ≥ 1 and m ∈ M}. In particular, F 1 is not finite. In contrast to this, Theorem 2 says that F 2 is empty and Theorem 3 says that F k is finite for k > 1. In part II [4] the problem of explicitly computing F k is considered.
Despite the progress made in this paper, for most second order recurrences (and the Fibonacci numbers belong to this class), the discriminator remains quite mysterious, even conjecturally. Thus in this paper we only reveal the tip of an iceberg.

Its discriminant is
is both the Lucas sequence having roots (α(k), α(k) −1 ), as well as the sequence of even indexed members of the Lehmer sequence having roots (β(k), β(k) −1 ) (cf. Bilu and Hanrot [2] or Ribenboim [11, pp. 69-74]). First we study the congruence U i (k) ≡ U j (k) (mod m) in case m is an arbitrary integer. By the Chinese Remainder Theorem, it suffices to study this congruence only in the case where m is a prime power. In this section we will only deal with the easiest case where m is a power of two.
Proof. This is clear for a = 0. When a = 1, we have U 0 (k) = 0, U 1 (k) = 1 and U n+2 (k) ≡ −U n (k) (mod 2). Thus, U n+2 (k) ≡ U n (k) (mod 2). This shows that U n (k) ≡ n (mod 2) for all n ≥ 0. Therefore U i (k) ≡ U j (k) (mod 2) implies that i ≡ j (mod 2), which is what we wanted. We now proceed by induction on a. Assume that a > 1 and that the lemma has been proved for a − 1. Let i ≤ j be such that U i (k) ≡ U j (k) (mod 2 a ). In particular, U i (k) ≡ U j (k) (mod 2) and so i ≡ j (mod 2). It is easy to check that putting V n (k) for the sequence given by V 0 (k) = 2, V 1 (k) = 4k + 2, we have The sequence {V n (k)} n≥0 satisfies the same recurrence as {U n (k)} n≥0 , namely Note that V n (k) = α(k) n + α(k) −n . Further, by induction on n using the fact that 2 V 0 (k) and 2 V 1 (k) and the recurrence for V (k), we conclude that if 2 V n (k) and 2 V n+1 (k), then , and 2 V (i+j)/2 (k), we get that 2 a−1 | U (i−j)/2 (k). Thus, U (i−j)/2 (k) ≡ U 0 (k) (mod 2 a−1 ) and by the induction hypothesis we get that (i − j)/2 ≡ 0 (mod 2 a−1 ). Thus, i ≡ j (mod 2 a ) and the induction is complete.

Index of appearance
We now need to study the congruence U i (k) ≡ U j (k) (mod p b ) for odd primes p and integers b ≥ 1. We start with the easy case when j = 0. Given m, the smallest n ≥ 1 such that U n (k) ≡ 0 (mod m) exists, cf. [2], and is called the index of appearance of m in U (k) and is denoted by z(m).
(For notational convenience we suppress the dependence of z(m) on k.) The following result is well-known, cf. Bilu and Hanrot [2]. We write ν p (m) for the exponent of the prime p in the factorization of the positive integer m. For an odd prime p we write ( • p ) for the Legendre symbol with respect to p.
Lemma 2. The index of appearance z of the sequence U (k) has the following properties.
Part i says that z(p b ) = p b in case p | ∆(k) and b ≥ 1. The next result describes what happens for arbitrary b and p > 2.
Lemma 3. Assume that p > 2 is such that p | ∆(k). Let z(p b ) be the index of appearance of p b in the sequence U (k).
3.1. Index of appearance in case k = 1. For notational convenience we ignore where appropriate the index k = 1 in U (k), α(k), β(k) and so we only write U, α, β. We have ∆(1) = 8 and the relevant quadratic field is where ρ is the conjugate of ρ obtained by sending √ 2 to − √ 2. For odd p, z(p) is a divisor of either p − 1 or p + 1 by Lemma 2 ii. The next lemma shows that even more is true.
Lemma 4. Let k = 1 and p be an odd prime. Then
Lemma 5. Let p be odd such that e = ( 2 p ) = −1 and let b ≥ 1 be an integer.
Since, moreover, p cannot divide both α m − 1 and α m + 1, it follows that p b must divide either α m − 1 or α m + 1. Proof. Assume that D 1 (n) = m and write it as where the last inequality needs proof. Indeed, it is equivalent with the inequality It suffices to justify that The second inequality is clear. The first is equivalent to p 1 p 2 > p 1 + p 2 + 1. Assuming 3 ≤ p 1 < p 2 , this inequality is implied by p 2 (p 1 − 2) > 1, which is obviously satisfied. Since z(m) < m/2 by (4), it follows that the interval [z(m), 2z(m)) contains a power of 2, say 2 b < 2z(m) < m. But then since 2 b ≥ z(m) ≥ n, it follows that U 0 , . . . , U n−1 are already distinct modulo 2 b and 2 b < m, which contradicts the definition of the discriminator. Thus, the only possibility is that r ∈ {0, 1}. If r = 1 and e 1 = ( 2 p 1 ) = 1, then and so the same contradiction applies. Assume now that e 1 = −1 and that z(p 1 ) is a proper divisor of (p + 1)/2. Then and again the same contradiction applies. It remains to prove part iii. We write m = 2 a p b 1 1 . We know that a ≥ 1 and e = −1. Thus, p ≡ ±3 (mod 8). If p ≡ 3 (mod 8), then In particular, z(m) < m/2, and we get again a contradiction. Thus, p ≡ 5 (mod 8).
Proof. Assume that D 1 (n) = m is odd. By the previous lemma, it follows that m = p b 1 1 , where ( 2 p 1 ) = −1 and z(p 1 ) = (p 1 + 1)/2. Further, in this situation (3) applies and we have Since b 1 ≥ 1 and p 1 ≥ 3, we have that i ≥ 0. Further, . Taking the difference of the latter two congruences we get that . Thus, taking norms and using the fact that p 1 is inert in K and so has norm Since i < j and by assumption U 0 , . . . , U n−1 are pairwise distinct modulo p b 1 1 , it follows that j ≥ n and hence, by (5), We check when the right hand side is less than m/2. This gives This holds whenever p b 1 1 ≥ 11. Thus, only the cases m = p b 1 1 ≤ 9 need to be checked, so n < 9. We check in this range and we get no odd discriminant. Thus, indeed n < m/2, and by the previous argument we can now replace m by a power of two in the interval [m/2, m), and get a contradiction.
Lemma 9. Assume that m = 2 a p b 1 1 is such that a ≥ 1, p 1 ≡ 5 (mod 8) and z(p 1 ) = ( . Let λ denote the common value of U i and U j modulo p b 1 1 . Then α i and α j are both roots of Taking the difference and factoring we get that Now various things can happen. Namely, p b 1 1 can divide the first factor or the second factor of (6). If b 1 > 1, some power of p 1 may divide the first factor and some power of p 1 can divide the second factor. We investigate each of these options.
We want to show that this case does not occur. If it does, then p 1 divides Assume first that p 1 | λ. Then p 1 | U i and p 1 | U j so both i and j are divisible by the odd number z(p 1 ) = (p 1 +1)/2. Also, i ≡ j (mod 2). Since i = z(p 1 )i 1 and j = z(p 1 )j 1 , where i 1 ≡ j 1 (mod 2) and α z(p 1 ) ≡ −1 (mod p 1 ), it follows that α i and α j are both congruent either to 1 (if i 1 and j 1 are even) or to −1 (if i 1 and j 1 are odd) modulo p 1 . Thus, modulo p 1 the expression (7) is in fact congruent to ±2 modulo p 1 , which is certainly not zero. Thus, λ = 0. Then The prime p 1 is inert so we can conjugate the above relation to get Multiplying the second congruence by α i+j and subtracting (9) from (8), we get 4 √ 2λ(α i+j + 1) ≡ 0 (mod p 1 ). Thus, α i+j ≡ −1 mod p 1 . But the smallest k such that α k ≡ −1 (mod p 1 ) is k = z(p 1 ) = (p 1 + 1)/2 which is odd. Hence, i + j is an odd multiple of z(p 1 ), therefore an odd number itself, which is a contradiction since i ≡ j (mod 2). Thus, this case does not appear. This implies that Conversely, assume i > j and i ≡ j (mod z(m)). We need to show that U i ≡ U j (mod m). Since i ≡ j (mod 2 a ), it follows that i − j is even and hence U i − U j = U (i−j)/2 V (i+j)/2 . Since 2 a−1 | (i− j)/2, we get, by iteratively applying the formula U 2n = U n V n , that In the right-hand side we have a factors from the V sequence and each of them is a multiple of 2. Hence, 2 a | (U i − U j ). As for the divisibility by p b 1 1 , note that since z(p b 1 1 ) | (i − j) and i − j is even, it follows that . The same holds if we replace α by α −1 . Thus, α i ≡ α j α i−j ≡ α j (mod p b 1 1 ), and the same congruence holds if α is replaced by α −1 . Subtracting these two congruences we get ). Computing norms in K and using the fact that p 1 is inert, we get p 2b 1 5. The end of the proof or why 5 and not 37?
We need a few more results before we are prepared well enough to establish Theorem 1. Proof. It is enough to show that there exists an strictly increasing sequence of integers {m i } ∞ i=1 of the form m i = 2 a i +1 · 5 b i with a 1 = 23 and b 1 = 3, a i , b i ≥ 0, having the property that Since both 2 7 /5 3 and 5 10 /2 23 are in (1, 111/95), the idea is to use the substitutions 5 3 → 2 7 and 2 23 → 5 10 to produce a strictly increasing sequence starting from m 1 . Note that we can at each stage make one of these substitutions as otherwise we have reached a number dividing 2 · 2 22 · 5 2 < m 1 , a contradiction.
Proof. Suppose that D 1 (n) = m, then we must have that is m ≥ 37n/19. By Lemma 10 in the interval [5n/3, 37n/19) there is an integer of the form m = 2 c · 5 d with c ≥ 1. This integer discriminates the first n terms of the sequence and is smaller than m. This contradicts the definition of the discriminator.
Thus we see that in some sense there is an abundance of the numbers of the form m = 2 a · 5 b that are in addition fairly regularly distributed. Since they discriminate the first n terms provided that m ≥ 5n/3, rather than the weaker m ≥ 2np/(p + 1) for p > 5, they remain as values, whereas numbers of the form m = 2 a · p b with p > 5 do not.
It remains to deal with p = 37. We will show that for k i = 2 · 37 i and 1 ≤ i ≤ 5, there is a power of the form 2 e i < k i that discriminates the same terms of the sequence as k i does, thus showing that k i cannot be a discriminator. By the same token, any potential value 2 α · 37 i , 1 ≤ i ≤ 6, is outdone by 2 α+e i . Any remaining value of the form 2 α · 37 i has i ≥ 6 and α ≥ 1 and cannot be a value by Corollary 3.
(Recall that the number 2 · 37 i discriminates the first 2 · 37 i−1 · 19 terms of the sequence and not more terms.) Note that thee numbers e i are unique if they exist. Some simple computer algebra computations yield e 1 = 6, e 2 = 11, e 3 = 16, e 4 = 21 and e 5 = 27.
Lemma 12. We say that m discriminates U 0 , . . . , U n−1 if these integers are pairwise distinct modulo m.
i) The integer m = 2 a discriminates U 0 , . . . , U n−1 if and only if m ≥ n.
At long last we are ready to prove Theorem 1.
Proof of Theorem 1. As the statement is correct for n = 1, we may assume that n > 1. By Lemma 11 it then follows that either m = 2 a for some a ≥ 1 or m = 2 a · 5 b with a, b ≥ 1. On invoking Lemma 12 we infer that the first assertion holds true. It remains to determine the image of the discriminator D 1 . Let us suppose that m = 2 a · 5 b with a, b ≥ 1 occurs as value. Let α be the unique integer such that 2 α < 2 a · 5 b < 2 α+1 . By Lemma 12 it now follows that we must have z(m) > 2 α , that is 2 a · 5 b−1 · 3 > 2 α . It follows that m occurs as value iff (Indeed, under these conditions we have D 1 (n) = 2 a · 5 b for n ∈ [2 a + 1, 2 a · 5 b−1 · 3].) Inequality (10) can be rewritten as 5/6 < 2 a−α−1 < 1 and, after taking logarithms, is seen to have a solution iff b ∈ M. If it has a solution, then we must have α − a = ⌊b log 5/ log 2⌋. In particular for each a ≥ 1 and b ∈ M, the number 2 a · 5 b occurs as value.
6. General k 6.1. Introduction. What is happening for k > 1? It turns out that the situation is quite different. For k = 2 we have the following result.
Proof. We have that if z(m) = m, then m|3 · 2 a for some a ≥ 0. For the other integers m we have z(m) ≤ 3m/5 (actually even z(m) ≤ 7m/13). It follows that if m discriminates the first n values of the sequence U (2), then we must have m ≥ 5n/3. It is easy to check that for every n ≥ 2 there is a power of two or a number of the form 3 · 2 a in the interval [n, 5n/3). As D 2 (1) = 1 we are done.
For the convenience of the reader we recall the theorem from the introduction which deals with the case k > 2. Let k > 2. We have

Theorem 3. Put
with equality if the interval [n, 3n/2) contains an integer m ∈ A k ∪ B k . There are at most finitely many n for which in (11) strict inequality holds. Furthermore, we have In our proof of this result the rank of appearance plays a crucial role. Its most important properties are summarized in Lemma 14.
6.2. The index of appearance.
6.2.1. The case where p | k(k + 1). The index of appearance for primes p dividing k(k + 1) is determined in Lemma 3 for p > 2. By Lemma 1 we have z(2 b ) = 2 b . In general z(p b ) = p b for these primes, but for a prime which we call special a complication can arise giving rise to z(p b ) | p b−1 for b ≥ 2.
Definition 1. A prime p is said to be special if p|k(k + 1) and p 2 |U p .
The special feature of a special prime p is that p b with b ≥ 2 cannot divide a discriminator value. Recall that z(p a ) = p max{a−c,0} z(p), where c = ν p (U z(p) ) by Lemma 2.
Proof. Taking i = 0 and j = p b−1 z(m 1 ) we have U i ≡ U j ≡ 0 (mod m). It follows that n ≤ p b−1 z(m 1 ) ≤ m/p so any power of 2 in [m/3, m) (and such a power exists) is a better discriminator than m.
By Lemma 3 only 3 can be special.

6.2.2.
The case where p ∤ k(k + 1). Let us now look at odd prime numbers p such that p ∤ k(k + 1). These come in two flavors according to the sign of Suppose that e p = 1. Then either In the first case, In the second case, a similar calculation shows that β p ≡ −β. Thus, β p−1 ≡ ±1 (mod p) and since α = β 2 , we get that α (p−1)/2 = β p−1 ≡ ±1 (mod p).
For the remaining integers m we have One has Furthermore, we have α k = 2/3 if k ≡ 1 (mod 3) and α k ≤ 3/5 otherwise. Proof of Lemma 14. By the above discussion if p ∤ k(k + 1), then z(p b ) < p b . Thus if z(m) = m, then m ∈ P(k(k + 1)). The first assertion now follows by Lemma 1 (which shows that z(2 b ) = 2 b ) and Lemma 3 and the observation From these inequalities we infer the truth of (15). The proof is concluded on noting that and that (p + 1)/2p is a decreasing function of p.
It is easy to see that if there is a prime p with z(p) = (p + 1)/2, then where q is the smallest prime such that z(q) = (q + 1)/2.
6.3. The congruence U i (k) ≡ U j (k) (mod m). In this subsection we study the congruence U i (k) ≡ U j (k) (mod m). As we said before, it suffices to study it modulo prime powers. For powers of 2, this has been done at the beginning of Section 2. So, we deal with prime powers p b . Recall that the discriminant ∆(k) equals 16k(k + 1). It turns out that primes p dividing ∆(k) are easier to understand than the others. From now on, we eliminate the index k from U n (k), α(k), ∆(k) and so on. We treat the case when p | k(k + 1). In case m is even, there are two subcases, one easy and one harder, according to whether p | k or p | (k + 1).
Proof. We prove the only if assertion. We let a be such that p a k. We put k(k + 1) = du 2 , and let K = Q[ √ d]. We let π be any prime ideal diving p and let e be such that π e p. For example, e = 2 if p | d. Let λ be the residue class of the number The same holds for α i replaced by α j . Hence, these numbers both satisfy the quadratic congruence Taking their difference we get In case p | k, we have that α = 2k + 1 + 2 k(k + 1) ≡ 1 (mod π). Thus, the second factor above is congruent to 2 (mod π ae/2 ). In particular, π is coprime to that factor. Thus, This leads to α i−j ≡ 1 (mod π be+ae/2 ). Changing α to α −1 and taking the difference of the above expressions we α i−j −α j−i ≡ 0 (mod π be+ae/2 ). Thus, 2 k(k + 1)U i−j ≡ 0 (mod π be+ae/2 ).
Simplifying the square-root which contributes a power π ae/2 to the left-hand side of the above congruence, we get U i ≡ U j (mod π eb ), and since this is true for all π | p, we get that U i ≡ U j (mod p b ). Now we treat the more delicate case p | (k + 1). The following lemma is the analogue of Lemma 15.
Lemma 16. Assume that p is odd and p | (k + 1). Then U i ≡ U j (mod p b ) is equivalent to one of the following: Proof. The proof is similar to the previous lemma. Let p a | (k + 1) and let π be some prime ideal in K such that π e | p. Then α = 2k + 1 + 2 k(k + 1) ≡ −1 (mod π ae/2 ).
Let again λ be the value of U i (mod p b ). The same argument as before leads us to the congruence (16). The first factor is congruent to The second one is congruent to (−1) i + (−1) j (mod π ae/2 ). Thus, π never divides both factors, and π ae/2 divides α i − α j in case i ≡ j (mod 2), and it divides α i + α j − 4 k(k + 1)λ in case i ≡ j (mod 2). In case i ≡ j (mod 2), we have α i ≡ α j (mod π be+ae/2 ). Thus, α i−j ≡ 1 (mod π be+ae/2 ). Arguing as in the proof of the preceding lemma yields U i−j ≡ 0 (mod p b ) and hence i ≡ j (mod z(p b )).
We now have to do the if parts. They are pretty similar to the previous analysis. We start with i ≡ j (mod 2). Then i−j ≡ 0 (mod z(p b )), so U i−j ≡ 0 (mod p b ). This gives as in the previous case α i−j ≡ α −(i−j) (mod π eb+ae/2 ), so α 2(i−j) ≡ 1 (mod π eb+ae/2 ). Thus, (α i−j −1)(α i−j +1) ≡ 0 (mod π be+ae/2 ). Since i − j is even, α i−j ≡ (−1) i−j (mod π) ≡ 1 (mod π), so the second factor is congruent to 2 (mod π), so it is coprime to π. So, α i−j − 1 ≡ 0 (mod π be+ae/2 ). Now the argument continues as in the last part of the proof of the preceding lemma to get to the conclusion that U i ≡ U j (mod p b ).
A similar argument works when i ≡ j (mod 2). With the same argument we get from i + j ≡ 0 (mod z(p b )) to the relation U i+j ≡ 0 (mod p b ), which on its turn leads to (α i+j − 1)(α i+j + 1) ≡ (mod π be+ae/2 ). Since i + j is odd, the factor α i+j − 1 is congruent to is −2 (mod π), so it is coprime to π. So, α i+j + 1 ≡ 0 (mod π eb+ae/2 ) and multiplying with a suitable power of α and rearranging we get α i ≡ −α −j (mod π be+ae/2 ), and also α −i ≡ −α j (mod π be+ae/2 ). Taking the difference of these last two congruences, we get α i − α −i − α j + α −j ≡ 0 (mod π be+ae/2 ), which is 2 k(k + 1)(U i − U j ) ≡ 0 (mod π be+ae/2 ). Simplifying 2 k(k + 1), we get that π be divides U i − U j , and since π is an arbitrary prime ideal of p, we conclude that Definition 2. We write P(r) for the set of positive integers composed only of prime factors dividing r.
Lemma 17. We have precisely when m ∈ A k ∪ B k .
Proof. Since 0 = U 0 (k) ≡ U z(m) (k) (mod m), we must have z(m) ≥ m. As z(m) ≤ m by Corollary 10 it follows that z(m) = m. First subcase: m is odd. Since z(m) = m all prime divisors of m must divide k(k + 1). Now suppose that m has an odd prime divisor p dividing k + 1. Thus m = p a m 1 with m 1 coprime to p and odd. Note that z(p a ) = p a . Consider i = (p a − 1)m 1 /2 and j = (p a + 1)m 1 /2. Then i ≡ j (mod 2) and p a | (i + j). Thus, U i ≡ U j (mod p a ) by Lemma 16. Since m 1 | i and m 1 | j and m 1 is composed of primes dividing ∆(k) = 16k(k + 1), it follows that U i ≡ U j ≡ 0 (mod m 1 ) and hence we have U i ≡ U j (mod m) with m ∤ (j − i). It follows that (17) is not satisfied. Thus we conclude that if an odd integer m is to satisfy (17) it has to be in P(k). For such an integer, by Lemma 15 and the Chinese remainder theorem, (17) is always satisfied. It follows that the solution set of odd m satisfying (17) is {m odd : z(m) = m and m ∈ P(k)}, which by Corollary 5 equals A k .
Second subcase: m is even. Both the left and the right side of (17) imply that i ≡ j (mod 2). On applying Lemmas 15 and 16 and the Chinese remainder theorem we see that in this case the solution set is {m even : z(m) = m}, which by Corollary 5 equals B k . 6.4. A Diophantine interlude. The prime 3 sometimes being special leads us to solve a very easy Diophantine problem (left to the reader).
Lemma 18. If k > 2, then k(k + 1) has an odd prime factor that is not special.
Proof. If k(k + 1) only has an odd prime factor that is special, then it must be 3 and k ≡ 2, 6 (mod 9). It follows that for such a k there are a, b for which the Diophantine equation has a solution. However, this is easily shown to be impossible for k > 2.
It is slightly more challenging to find all solutions k ≥ 1 of (18). In that case one is led to the Diophantine equation which was already solved centuries ago by Levi ben Gerson (alias Leo Hebraeus), who lived in Spain from 1288 to 1344, cf. Ribenboim [10, p. 5]. It has the solutions (a, b) = (1, 0), (0, 1), (2, 1) and (a, b) = (3, 2), corresponding to, respectively, k = 1, 2, 3 and k = 8. 6.5. Bertrand's Postulate for S-units. Before we embark on the proof of our main result we make a small excursion in Diophantine approximation.
Lemma 19. Let α > 1 be a real number and p be an arbitrary odd prime. Then there exists a real number x(α) such that for every n ≥ x(α) the interval [n, nα) contains an even integer of the form 2 a · p b .
Proof. Along the lines of the proof of Lemma 10. If β is irrational, then the sequence of integers {mβ} ∞ m=1 is uniformly distributed. This allows one to find quotients 2 c /p d and p r /2 s that are in the interval (1, α). Then proceed as in the proof of Lemma 10.
The result also holds for S-units of the form s i=1 p b i i with p 1 < . . . < p s primes and s ≥ 2.
In [4] we consider the Bertrand's Postulate for S-units in greater detail.
6.6. Proof of the main result for general k. Finally we are in the position to prove our main result for k > 1.
Proof of Theorem 3. Let k > 2. First case: m ∈ A k ∪ B k . (Note that z(m) = m for these m.) By Lemma 17 we infer that the inequality (11) holds true and moreover the equivalence (12). The "⇐" implication in (12) yields A k ∪ B k ⊆ D k .
Second case: z(m) = m and m ∈ A k ∪ B k . In this case m has a odd prime divisor p that also divides k + 1. Now write m = p a · m 1 with p ∤ m 1 and m 1 odd. Note that z(p a ) = p a . Consider i = (p a − 1)m 1 /2 and j = (p a + 1)m 1 /2. Then i ≡ j (mod 2) and p a | (i + j). Thus, U i ≡ U j (mod p a ) by Lemma 16. Since m 1 | i and m 1 | j and m 1 is composed of primes dividing ∆(k), it follows that U i ≡ U j ≡ 0 (mod m 1 ). This shows that if m discriminates the numbers U 0 (k), . . . , U n−1 (k), then n ≤ p a + 1 2 m 1 .
The interval [(p a + 1)/2, p a ) contains a power of 2, say 2 b . Then 2 b m is a better discriminator than p a m 1 = m. Thus if z(m) = m and m ∈ A k ∪ B k , then m is not a discriminator value. Third case: z(m) < m. Here it follows by Lemma 14 that z(m) ≤ α k m ≤ 2m/3. In order for m to discriminate the first n terms we must have n ≤ z(m) ≤ 2m/3, that is m ≥ 3n/2. Now if in the interval [n, 3n/2) there is an element from A k ∪ B k , this will discriminate the first n terms too and is a better discriminator than m. Thus in this case in (11) we have equality.
Since by assumption k > 2, by Lemma 18 there exists a non-special odd prime p dividing k(k + 1) and hence if a, b ≥ 0, then 2 1+a · p b ∈ A k ∪ B k . It now follows by Lemma 19 that for every n large enough the interval [n, 3n/2) contains an element from A k ∪ B k and so there are at most finitely many n for which in (11) strict inequality holds. 6.7. The set F k . As was remarked in the introduction a consequence of Theorems 2 and 3 is that for k > 1 there is a finite set F k such that The set F k is not a figment of our proof of this result, as the following result shows.
Lemma 20. There are infinitely many k for the finite set F k is non-empty. It can have a cardinality larger than any given bound.
Proof. Let N be large and k ≡ 1 (mod N !). Then U (k) (mod m) is the same as U (1) (mod m) for all m ≤ N . In particular, if N > 2 · 5 ms , where m s is the s th element of the set M, then certainly D 1 ∩ [1, N ] will contain the numbers 2 · 5 m i for i = 1, . . . , s, and 5 ∤ k(k + 1) (in fact, k ≡ 1 (mod 5), so 5 ∤ k(k + 1)), therefore all such numbers are in the set F k for such values of k.
Thus it is illusory to want to describe F k completely for every k ≥ 1. Nevertheless, in part II [4] we will explore how far we can get in this respect.

Analogy with the polynomial discriminator
In our situation for k ≥ 1 on the one hand there are enough m with z(m) = m and D k (m) = m, on the other hand for the remaining m either z(m) = m and m is not a discriminator value or we have z(m) ≤ α k m with α k < 1, a constant not depending on m. Thus the distribution of {z(m)/m : m ≥ 1} shows a gap directly below 1 (namely (α k , 1)).
For polynomial discriminators the analogue of z(p) is V (p), the number of values assumed by the polynomial modulo p. If on the one hand there are enough integers m such that f permutes Z/mZ, and on the other hand V (p)/p with V (p) < p is bounded away from 1 (thus also shows a gap directly below 1), then the polynomial discriminator can be easily described for all n large enough. See Moree [7] and Zieve [13] for details.