Manuscript Offprint
arXiv:2610.34300Three Quadratic Recurrences Modulo 3: What We Can Prove and What We Can Guess
Abstract
We study three innocent-looking recurrences modulo 3, each built from squares of two earlier terms. One of them turns out to be secretly linear, and we can compute its periods exactly. One is a permutation hiding a small, perfectly orderly piece inside a large, random-looking one. The third looks thoroughly random, but it still has a few provable features. Along the way we meet open problems that need nothing beyond a first course in abstract algebra to state. This paper is a starting point, not the final word in any sense.
1 The setup
Fix an integer and start a sequence of elements of with
We continue it with one of three rules (all arithmetic mod 3):
(A)
(B)
(C)
Each new term depends on the previous terms, and there are only possible blocks of terms. So every sequence is eventually periodic: there are a least period and a least pre-period such that for all . We write (and similarly ) for the three rules.
The one trick we need. Write for 1 if the statement is true and 0 if it is false.
Lemma 1. For we have and .
Proof. Check the three cases:
\begin{array}{c|ccc}{{{c}}}&{{{0}}}&{{{1}}}&{{{2}}} \\{{{\hline c^{2}}}}&{{{0}}}&{{{1}}}&{{{1}}} \\{{{\hline 2(c^{2}+c)}}}&{{{0}}}&{{{1}}}&{{{0}}} \\\end{array}
So the three rules really read
(A)
(B)
(C)
Rules (A) and (B) use the same two ingredients with the lags swapped. As we will see, they behave completely differently.
| k | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 3 | 7 | 15 | 21 | 63 | 127 | 63 | 73 | 889 | 1533 | 3255 |
and for every . Many of these numbers are of the form , which hints at the field .
For a polynomial with , its order ord is the least with dividing (equivalently, ); such an exists because is a unit modulo ). A polynomial of degree is primitive if its order is ; for both notions see [6, Ch. 3, §1].
Theorem 2. For we have and . In particular , with equality exactly when is primitive.
Proof. Step 1: reduce to . Put . By the rule, exactly when exactly one of equals 1. Hence, for ,
a linear recurrence, with and .
Step 2: the period of . Let . Then , where is the companion matrix of . Since , is invertible, so is purely periodic and can be implemented backwards. The vectors form a basis: they are “triangular”, because the first 1 of moves one place left each time. If , then fixes every , so . The period of is therefore the order of the matrix . That is the least with , because is the minimal polynomial of its companion matrix. Finally, and its reversal divide exactly the same polynomials , so they have the same order. (This is the standard link between linear recurring sequences and orders of polynomials; see [6, Ch. 8].) The orbit of the nonzero vector never reaches 0, so the period is at most .
Step 3: back to , and . Implementing backwards from the initial data gives , , and . A direct check shows
For this is the rule itself, and for it is a quick check. The right-hand side is purely periodic with the same period as (since recovers ). At it equals . So the sequence is periodic from on but not from , and .
Remark 3. The polynomial has no repeated factors, so is the least common multiple of the orders of its irreducible factors [1, Lemmas 3.1–3.2]. For instance gives .
Parts (2) and (3) below are the easy halves of Bartholdi's Propositions 2.2–2.3 [1].
Corollary 4. Let .
-
If , then .
-
divides .
-
divides .
Proof. (1) For we have , because . Hence divides . A divisor's order divides the order, and .
For (2) and (3) we use the “freshman’s dream” , valid in characteristic 2, which gives .
(2) Modulo we have . So , and because is a unit.
(3) Modulo we have . So , and therefore .
In fact equality holds in (2) and (3): for and for , as proposed in [3]; see the proof in [1] and a list of periods in OEIS A046932 [4].
Conjecture 5. for .
Bartholdi verified this for by computer; for instance , , , and (note ). He also proved half of the conjecture [1, Prop. 2.4]; here is a short proof in our language.
Proposition 6. For , divides .
Proof. Let , , and work in the ring . The squaring map is additive on . For a polynomial , define the map . Because is additive, . In we have , that is, for . Let and write . Then . So in , and therefore divides .
What is missing for the conjecture is to show that does not have a smaller order in .
3 Recurrence (B): a permutation with an orderly corner
Some data:
| k | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|
| 8 | 22 | 45 | 138 | 415 | 916 | 3998 | 13142 | 38763 |
and for all . The reason is easy.
Proposition 7. For the map is a bijection of . Hence every orbit is a cycle and . Its only fixed point is 0.
Proof. From we can recover , so is injective, and hence bijective on a finite set. A bijection of a finite set moves every point around a cycle. If , then is constant, say equal to , with , so .
Thus is the length of the cycle of the permutation through . Computer decompositions for show two kinds of cycles: thousands of short cycles of length , and a handful of huge ones. The short ones can be described exactly.
Theorem 8. Let . The number of states fixed by is
Proof. Since is a bijection, states fixed by correspond to two-sided sequences of period dividing satisfying , where . Arrange one period in a array, with in row and column . Going down a column, the four increments are the -values of the previous column (for , the last column shifted by one row). They add up to .
Each column has 1 or 4 zeros. The number of nonzero entries in a column is 0 or 3, because it is a multiple of 3 and at most 4. If some column is all zeros, the next column has all increments 0, so it is constant. It must then also be all zeros, since a constant nonzero column has no zeros at all. Repeating this around the array gives , the fixed point.
Where the single zeros sit. Suppose the zero of one column is in row u. The next column then reads in rows . The value would give two zeros, puts the zero in row , and puts it in row . In terms of positions mod 4k, consecutive zeros (one per column) differ by or , and the wrap-around from the last column to the first behaves the same way. Conversely, any such choice of zero positions determines the columns and gives a solution.
Counting. Choose the zero in column 0 (4 ways), then a sequence of k steps, each or , that returns to the start. If e steps equal , the total is , and this is exactly when . The closed form follows from the standard roots-of-unity filter with .
For example, at every nonzero state is counted (8 of them), matching . At the count is 40, which is two 20-cycles.
Corollary 9. For , does not divide 4k.
Proof. In the theorem’s solutions no two zeros are adjacent, because neither nor is . The starting block has adjacent zeros when .
So the orderly corner, about of the states, misses our starting point. The remaining states resemble a random permutation: for the largest cycle averages about , close to the Golomb-Dickman constant predicted for random permutations [7, 8].
Conjecture 10. As , the ratios behave like independent uniform random numbers in .
4 Recurrence (A): looks random, but not entirely
Some data:
| k | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 4 | 4 | 9 | 19 | 4 | 4 | 22 | 36 | 4 | 4 | 45 |
The value 4 keeps reappearing. Here the pre-periods are huge: for example and . Throughout this section let and for .
Proposition 11. For we have .
Proof. First, is not eventually 0. Otherwise, let be least with for all . Then , and for we get . That means for all , contradicting the choice of .
Now take a window of one full period , with large. The increments add up to . But their sum is the number of nonzero terms in another full period, the one shifted by . So , and , which gives . If , then every term is nonzero, so every , and the window contains all three residues, including 0. That is a contradiction.
Proposition 12. If , the eventual cycle is and , or it is and . Conversely, for each such the corresponding 4-periodic sequence satisfies the rule.
Proof. By the previous proof, each period of 4 contains exactly one zero, say at residue . A block has increments , so , , and . The single increment equal to 0 sits at residue (if ) or (if ). Since vanishes only when , we get or . Checking the converse is direct.
The condition is necessary but not sufficient: and . There is, however, an exact test that you can employ on a computer.
Proposition 13 (Capture criterion). Let or and . Then if and only if, beyond index , the zeros of at some point form consecutive gaps of exactly 4.
Proof. The “only if” part is clear. For “if”, suppose the run of zeros ends at . As in the previous proof, every block between consecutive zeros reads . So is known on , an interval of length , and . The data determine everything that follows, and they coincide with the data of the 4-periodic solution of Proposition 12 with a zero at . So follows that solution from on.
Conjecture 14. for all , and for all .
The evidence is modest: the first family has been checked for (up to ), the second only for . Computer experiments suggest a heuristic “race” picture. Long runs of zeros spaced 4 apart appear, copy themselves about steps later, and die out at
The words “gap” and “run” within Proposition 12 and its proof are defined in the first Addendum.
random. Capture happens when one run happens to reach length , unless the sequence first falls into some other long cycle. Roughly three quarters of the up to 411 give . Statistics gathered before capture do not seem to distinguish the two outcomes. This makes us suspect that no simple sufficient condition on exists. But that is a guess, not a theorem!
5 Summary
| Rule | Character | Proved | Conjectured |
|---|---|---|---|
| (C) | linear over | ; divisibility results; Bartholdi's theorems | |
| (B) | permutation of | ; exact count of states of period dividing ; | looks uniformly random |
| (A) | random-looking | ; shape of 4-cycles;; capture criterion | . |
6 Addendum: short runs of zeros in recurrence (A)
The setting
As in the main paper, fix and let be given by
Write , which is 1 if and 0 if . Since in , the rule says that the step
satisfies
So once we are past index , the sequence can only stay put or go up by 1 (mod 3) at each step. Everything below follows from this observation.
In the main paper we saw that when or , the zeros of can line up 4 apart forever, which gives a 4-cycle. Here we show the opposite for the other two residue classes: for those , zeros spaced 4 apart can only form short runs.
What we mean by a run
Definition 15. Let and be integers. We say that has a run of zeros spaced exactly 4 apart, with gaps, starting at , if
-
, and
-
for every other with .
In words: the positions are zeros, there are no other zeros between and , and so the gap between each pair of consecutive zeros in this stretch is exactly 4. The number counts the gaps, not the zeros.
For example, if the zeros of near some index sit at
then positions form a run with gaps. Position is not part of it, because the gap from to is 3.
We ask for so that (1) holds for every step inside the run. (Every step we use satisfies .) Nothing is assumed about what happens before or after , so the run need not be maximal.
The result
Theorem 16. Suppose or . Then every run of zeros spaced exactly 4 apart (in the sense of Definition 15) has at most gaps, that is,
Concretely, if , and if .
The proof uses one simple lemma about what a single block of a run must look like.
Lemma 17. Inside a run as in Definition 15, every block of five consecutive terms from one zero to the next reads
where * is 1 or 2. Consequently, for :
• if , then (the step that lands on a zero);
• if , then (the step that leaves a zero).
Proof. Write the block as 0, a, c, e, 0 with . Its four steps are , and by (1) each of them is 0 or 1.
• The first step is , and , so .
• The last step is , so . Since , we get .
The middle entry c is 1 or 2, and either value gives steps in . The two bullet points then read off the first and last steps.
Proof of Theorem 16. Take a run with g gaps starting at r. Suppose, aiming for a contradiction, that the run is long, in the sense that
Look at the step at position . Because , this position lies inside the run: . By (1),
because . In words: the rule “looks back” exactly places, sees the zero at the start of the run, and therefore forces a step of 0.
Now use Lemma 17 to compute the same step a second way.
-
Case . Then , so is one of the zero positions . By the lemma, .
-
Case . Then , so for some . Since , we have , so , and is the second entry of a block. By the lemma, .
Either way , which contradicts . So the run cannot be long, and therefore
Since is an integer, . (When , the largest multiple of 4 that is at most is , so . When , we get exactly .)
An example and some remarks
Example 18. Take . Then , so the theorem says that beyond index 4 there is not even one pair of consecutive zeros exactly 4 apart. You can check this against the first 60 terms of the sequence, shown below with each row starting at the index in the left column; the zeros beyond index 4 are in bold.
| n | , , ..., | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 2 | 0 | 1 |
| 11 | 2 | 0 | 0 | 1 | 2 | 2 | 2 | 0 | 1 | 2 |
| 21 | 0 | 0 | 1 | 2 | 2 | 2 | 0 | 1 | 2 | 0 |
| 31 | 0 | 1 | 2 | 2 | 2 | 0 | 1 | 2 | 0 | 0 |
| 41 | 1 | 2 | 2 | 2 | 0 | 1 | 2 | 0 | 0 | 1 |
| 51 | 2 | 2 | 2 | 0 | 1 | 2 | 0 | 0 | 1 | 2 |
Past index 4, the zeros sit at
9, 12, 13, 18, 21, 22, 27, 30, 31, 36, 39, 40, 45, 48, 49, 54, 57, 58,
and the gaps between consecutive ones are only ever 1, 3 or 5, never 4. For the bound is : single gaps of 4 are allowed, but never two in a row.
Remark 19 (Why are different). The same argument with or 3 (mod 4) lands on a step or . Those are the steps into and out of the middle entry *, and one of them may well be 0. So there is no contradiction, and indeed the 4-cycles and of the main paper are runs that go on forever.
Remark 20 (The bound is sharp in practice). Empirical data suggest that Theorem 16 is the best possible. For instance, runs with exactly gaps were observed for (where ) and for (where ). Proving that such maximal runs always occur would be a nice exercise in experimentation, but maybe a hard one in theory!
7 Addendum: The moment of capture in recurrence (A)
The setting
As in the main paper, fix and let satisfy
Write . Throughout, suppose that or and that the eventual period is . Put
We use the same notion of run as in the first Addendum: zeros at with and no other zeros in between. Such a run has gaps.
By the capture criterion of the main paper, the sequence settles into its 4-cycle as soon as some run reaches G gaps. This suggests the following definitions.
Definition 21. The capture point is the smallest index such that has a run of zeros spaced exactly 4 apart, with gaps, ending at . Its first zero is .
Definition 22. As usual, the pre-period is the least with for all . Equivalently, is the last index at which .
The guess
Conjecture 23. For every with ,
Equivalently, the last disagreement with the 4-cycle happens exactly two steps before the capture point:
In words: capture always “clicks in” in the same way. The final run of length G is completed, and everything after position z - 2 is already in step with the cycle. The cycle is never reached earlier than that, and there is never a stray mismatch after it.
Remark 24 (What it says about the run's neighborhood). Inside the capturing run, every block between consecutive zeros reads 0, 1, *, 2. Its middle entry * is determined by a value of b exactly k places back. Following this through, the conjecture amounts to a small condition on the terms just before the run starts at s:
So the conjecture is really a statement about how the capturing run begins.
The evidence
The identity was observed, with no exceptions, for
which covers both residue classes are ; the rest are (mod 4)). The pre-periods range from (for ) to (for ), where the capture point is . A nice first project would be to test more values of , then to look for the reason. Why should the sequence, after wandering for steps, always arrive at its cycle through the same narrow door?
Acknowledgements
I gratefully acknowledge Bob Harder’s original Fortran-based computations in 2000 (now extended by my C program). Conversations with both Anthropic Claude Opus 5.5 and OpenAI GPT-6 Luna were essential in the preparation of this paper. No AI funding whatsoever for this study was received. Proposition 12 was anticipated in [5]. My interest in the subject arose long ago in [2]; is understood, but our seemingly simpler recurrence (A) here defies explanation.
References
[1] L. Bartholdi, Lamps, factorizations, and finite fields, Amer. Math. Monthly 107 (2000) 429–436; https://arxiv.org/abs/math/9910056.
[2] J. Cassaigne and S. R. Finch, A class of 1-additive sequences and quadratic recurrences, Experim. Math. 4 (1995) 49–60; https://www.maths.tcd.ie/EMIS/journals/EM/expmath/volumes/4/4.html.
[3] 34 International Mathematical Olympiad, Istanbul, 1993, Day 2, Problem 6; https://www.imo-official.org/problems/1993/.
[4] The On-Line Encyclopedia of Integer Sequences, sequences A046932, A112683, A112684; https://oeis.org/.
[5] V. Miller and R. Pinch, https://mathoverflow.net/questions/50678/finchs-sequence-over-mathbbf-3.
[6] R. Lidl and H. Niederreiter, Finite Fields, 2nd ed., Cambridge Univ. Press, 1997.
[7] S. R. Finch, Mathematical Constants, Cambridge Univ. Press, 2003; §5.4, Golomb-Dickman constant.
[8] S. R. Finch, Mathematical Constants II, Cambridge Univ. Press, 2019; §1.20.3, Extreme prime factors.