PERIODS OF DUCCI SEQUENCES AND ODD SOLUTIONS TO A PELLIAN EQUATION

A Ducci sequence is a sequence of integer $n$ -tuples generated by iterating the map $$\begin{eqnarray}D:(a_{1},a_{2},\ldots ,a_{n})\mapsto (|a_{1}-a_{2}|,|a_{2}-a_{3}|,\ldots ,|a_{n}-a_{1}|).\end{eqnarray}$$ Such a sequence is eventually periodic and we denote by $P(n)$ the maximal period of such sequences for given $n$ . We prove a new upper bound in the case where $n$ is a power of a prime $p\equiv 5\hspace{0.6em}({\rm mod}\hspace{0.2em}8)$ for which $2$ is a primitive root and the Pellian equation $x^{2}-py^{2}=-4$ has no solutions in odd integers $x$ and $y$ .

A sequence of integer n-tuples obtained by iterating this map is known as a Ducci sequence, in honor of E. Ducci, who first studied them in the 1930s and discovered that every such sequence of integer n-tuples eventually stabilizes at (0, 0, . . ., 0) if and only if n is a power of 2, see [8].
Ducci sequences and their generalizations have received much attention in the literature, see for example [4-7, 9, 11, 18] and the references therein, and they have been independently rediscovered in various guises by various authors, for example in [1-3, 12, 16].
Since the entries in a Ducci sequence remain bounded, the sequence eventually becomes periodic, and in this paper, we're interested in the period P(n) of the Ducci sequence starting with (0, . . ., 0, 1).
The function P(n) was studied in detail in [11], where the following results may be found: The period of any Ducci sequence of n-tuples divides P(n), n divides P(n) and P(2 k n) = 2 k P(n), thus it suffices to study P(n) for odd n.Furthermore, one has the following upper bounds on P(n).

2.
Suppose there exists an integer M for which 2 M ≡ −1 mod n, in this case we say that "n is with a −1".Let M be the smallest such integer, then P(n) divides B 2 (n) := n(2 M − 1).
In [4] we list the first few odd values of n satisfying various sharpness conditions relative to the bounds in Theorem 1.1.In particular, the first examples of n with a −1 for which P(n) < B 2 (n) were found to be n = 37, 101, 197, 269, 349, 373, 389, 541, 557 and 677.Searching the Online Encyclopedia of Integer Sequences we find that, with the exception of 541, these are the first nine entries of Sequence A130229 [15]: the primes of the form p ≡ 5 mod 8 for which the Pellian equation has no solution in odd integers x and y.
Our goal is to prove the following result, which explains this discovery.
Theorem 1.2.Let p ≡ 5 mod 8 be a prime such that 2 is a primitive root modulo p, and for which the equation (1.1) has no solution in odd integers x and y.Then P(p) divides 1 3 B 2 (p).If furthermore p is not a Wieferich prime, then P(p k ) divides 1  3 B 2 (p k ) for all positive integers k.
Recall that an integer a is a primitive root modulo n if ord n (a) = ϕ(n), i.e. a generates (Z/nZ) * .Artin's Conjecture states every non-square integer a −1 is a primitive root modulo p for infinitely many primes p.When 2 is a primitive root modulo n, then 2 ord n (2)/2 ≡ −1 mod n, so n is with a −1.
A prime p is called a Wieferich prime if 2 p−1 ≡ 1 mod p 2 .Only two Wieferich primes are known, 1093 and 3511, neither of which satisfies the hypothesis of Theorem 1.2.However, a standard heuristic argument suggests that the number of Wieferich primes p ≤ x should grow like log log(x), see [5, §9].
The condition that 2 be a primitive root modulo p in Theorem 1.2 is essential: the first entry in sequence A130229 which for which 2 is not a primitive root is 997 and in fact we have P(997) = B 2 (997) = 997(2 166 − 1).

Periods and cyclotomy
It is known (see e.g.[7]) that the tuples in the periodic part of a Ducci sequence all lie in {0, c} n , for some constant c.Therefore, after discarding the common factor c, we may assume that all entries lie in {0, 1} n = F n 2 , in which case the Ducci operator D becomes linear: (a 1 , a 2 , . . ., a n ) → (a 1 + a 2 , a 2 + a 3 , . . ., a n + a 1 ).Next, mapping a tuple u = (a 1 , a 2 , . . ., a n ) to the element represented by the polynomial f = a 1 x n−1 +a 2 x n−2 +• • •+a n in the ring R = F 2 [x]/ x n −1 , we find that the Ducci sequence u, Du, D 2 u, . . .∈ F n 2 corresponds to the sequence f, (x+1) f, (x+1) 2 f, . . .∈ R, an idea going back to [18].
We thus find that P(n) equals the multiplicative period of x + 1 in R. Realizing R as the ring of cyclotomic integers modulo 2, we thus obtain (see [5,Thm.Since (O L /P) * has order B 1 (n), we recover the bound [10,Prop. 3.5.5],so one source of sharper bounds on P(n) is when the units of O L generate a proper subgroup of (O L /P) * .Determining the units of O L is generally difficult, but under certain circumstances this phenomenon can be detected already at the level of a quadratic subfield Q( , which is where the Pellian equation (1.1) comes into play.
By [10,Prop. 3.4.1 and Prop.3.5.14],Q(ζ p ), and thus also L, contains the real quadratic field K = Q( √ p), whose ring of integers is Since p is inert in L/K, we have Gal(L/K) Gal (O L /P)/(O K /p) , and thus the norm where the second vertical map is the norm of finite fields, which is surjective by [10,Prop. 2.4.12].
The group of units O * K is generated by −1 and the fundamental unit ε = (x + y √ p)/2, where (x, y) is the fundamental solution to the equation (1.1), see [10,Prop. 6.3.16] and [17].Therefore, we see that the units O * K generate the trivial subgroup {1} < (O K /p) * F * 4 if and only if (1.1) has no odd solutions.In this case, the image of the bottom horizontal arrow is a subgroup of index 3.It follows that the image of the top arrow lies in a subgroup of index 3 and thus P(n)| 1  3 B 1 (n).Since p ≡ 1 mod 4, we have 3|B 2 (n) = n(2 p k−1 (p−1)/2 − 1) and so the following lemma completes the proof of Theorem 1.2.Lemma 3.1.Suppose n is with a −1.Let n be an odd prime with |B 2 (n).Then P n, we have |2 m/2 − 1.Since is odd, 2 m/2 + 1.Now denote by v (x) the -adic order of x.We have The result follows.

Remarks
As the example of p = 997 shows, our argument requires 2 to remain prime in Q(ζ n ).This means that 2 generates (Z/nZ) * and so n = p k for some prime p.We must have p ≡ 3 or 5 mod 8, otherwise 2 is a square modulo p.Furthermore, we need 3|B 2 (n), which requires p ≡ 1 mod 4.This explains the condition p ≡ 5 mod 8.
We expect that there are infinitely many primes p for which (1.1) has no odd solutions.Heuristically, we expect the fundamental unit to fall in each of the three nonzero residue classes modulo p with equal probability, which suggests that these primes have density 1/3 in the set of all primes p ≡ 5 mod 8.Meanwhile, the Generalised Riemann Hypothesis implies that the proportion of primes p ≡ 5 mod 8 for which 2 is a primitive root is A/2, where A ≈ 0.3739558 is Artin's constant, as follows from the main result of [14].Assuming that these two conditions on p are independent, we thus expect that the primes satisfying the hypothesis of Theorem 1.2 have density A/6 ≈ 0.0623259689.
Numerically, we find that for primes up to 10 9 , this proportion is 0.0612819, but this proportion creeps up as one considers ever larger upper bounds on p, see Figure 1.This suggests that a Chebychev bias-type phenomenon might be at work.
It is known that there are infinitely many squarefree integers d ≡ 5 mod 8 for which the equation x 2 − dy 2 = 4 has no odd solutions, see [17].(One can replace −4 by 4 in (1.1), this has the effect of merely squaring the fundamental unit).Finally, our argument is related to that in [13].That paper considers the same fields K ⊂ L as we do, and uses the unit N L/K (1 + ζ n ) ∈ O * K to produce a relatively small solution to (1.1).

1 .
Suppose n is odd.Denote by L = Q(ζ n ) the n th cyclotomic field, where ζ n ∈ C is a primitive n th root of unity.Denote by O L = Z[ζ n ] the ring of integers in L. Let P ⊂ O L be a prime ideal containing 2. Then P(n) equals the lowest common multiple of the multiplicative orders of ζ + 1 modulo P, where ζ ranges over all n th roots of unity ζ 1.

Figure 1 .
Figure 1.Proportion δ(x) of primes p ≤ x for which the hypothesis of Theorem 1.2 holds