The period the golden ratio sets
Worth reading first: How a polynomial breaks modulo the primes · The integers a field contains.
Write down the Fibonacci numbers and keep only their last digits: 0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, … Each digit is the last digit of the sum of the two before it, so the whole sequence of last digits is determined by any two consecutive ones, and since there are only a hundred possible pairs, the sequence must eventually come round to a pair it has seen and repeat for ever. It does so after sixty terms, and it returns to its very beginning, 0 and 1, because the rule can be run backwards as well as forwards. The same is true modulo any whole number : the Fibonacci numbers modulo repeat with a period, called the Pisano period , after Leonardo of Pisa who introduced the sequence.
The periods look erratic: , , , , , . But at the primes they follow a law that is visible at once when they are plotted.
Every dot lies on one of two lines, or , or on a fraction of one: a half, a third, a quarter. Which line is decided by the prime’s remainder on division by 5. Primes congruent to modulo 5 — those ending in 1 or 9 — have periods dividing . Primes congruent to — ending in 3 or 7 — have periods dividing , and never dividing . The primes 2 and 5 are exceptions, with periods 3 and 20. This essay explains the law by the field the golden ratio lives in, which is the theme of the polynomial that breaks modulo the primes applied to the simplest interesting polynomial, .
Sixty last digits
The last digits first, because they show how periods combine. A number’s last digit is fixed by its remainders on division by 2 and by 5, so the Fibonacci numbers modulo 10 repeat exactly when they repeat both modulo 2 and modulo 5.
Modulo 2 the sequence is 0, 1, 1, 0, 1, 1, …, with period 3: every third Fibonacci number is even. Modulo 5 the period is 20. The least common multiple of 3 and 20 is 60, and that is the period of the last digits. The zeros come every fifteen terms, so every fifteenth Fibonacci number is divisible by 10; the first is . In general is the least common multiple of at the prime powers dividing , by the Chinese remainder theorem, so the primes decide everything.
Where the golden ratio lives
Binet’s formula writes the Fibonacci numbers through the golden ratio:
where and are the two roots of . Over the real numbers is irrational, and the integers of the field it generates are the numbers . To work modulo a prime , the same formula can be used inside a finite field, provided there is a field of characteristic that contains roots of .
There are two cases, and they are the two lines. If has roots among the remainders modulo — two whole numbers and with — then and are ordinary elements of the field of elements. By Fermat’s little theorem, and , so Binet’s formula repeats after steps, and the period divides . Modulo 11, for instance, , and indeed .
If has no roots modulo , they must be adjoined: the field of elements contains them, just as the field of real numbers of the form contains over the rationals. In that larger field the map is an automorphism, the Frobenius, which fixes the remainders modulo and must send a root of to a root. It cannot fix , since is not a remainder, so it sends to its conjugate:
Multiplying by gives , and squaring gives . The same holds for , so Binet’s formula repeats after steps, and the period divides . It cannot divide , because .
The minus sign in has a source worth naming. The product of the golden ratio and its conjugate is : the golden ratio is a unit of the integers , with norm , the generator of the one-dimensional lattice of units that units that form a lattice described for quadratic fields. In the field of elements, , which is the norm, and the norm is whatever the prime. The factor of two in is that minus sign. A unit of norm , such as in its own field, would give periods dividing instead. The same norm is why the golden rectangle that eats itself alternates between too long and too short as it is cut down: the convergents overshoot and undershoot in turn, because .
The table checks this for nine small primes by computing directly, as with and remainders and the rule : for 11, 19, 29, 31 and 41 the answer is , and for 3, 7, 13 and 47 it is . Which case occurs is the question whether 5 is a square modulo , since the roots of are ; and by quadratic reciprocity, 5 is a square modulo an odd prime exactly when is a square modulo 5, which means . The last digit of a prime decides its Fibonacci period because reciprocity turns a question about ’s arithmetic into a question about 5’s.
This is the simplest case of the census in the essay on how a polynomial breaks modulo the primes, where splitting in three different ways modulo different primes recorded the structure of its Galois group. For the Galois group has two elements, the identity and the swap of with , and the Frobenius at is one or the other: the identity for primes ending in 1 or 9, the swap for primes ending in 3 or 7. The Fibonacci period is the Frobenius made visible.
How long the period actually is
The law gives a bound, not the period. The period is the order of in the multiplicative group of its field — or twice or four times that, according to signs — and it can be any divisor of the bound compatible with the case. The index, the bound divided by the period, measures how far short it falls.
For primes below 10,000 the full period is the most common case in both classes: 322 of the 609 primes ending in 1 or 9 have period exactly , and 486 of the 617 ending in 3 or 7 have period exactly . The rest fall short by small factors, mostly two and three for the first class. For the second class the index is always odd — 1, 3, 7, 9, never 2 — because the period cannot divide , so it cannot lose a factor of two. A few primes fall very far short: the period modulo 9349 is only 38, an index of 246, the largest in the range — which is the statement that 9349 already divides , a Fibonacci number barely larger than the prime squared.
Whether infinitely many primes have the full period is a question of the same kind as Artin’s conjecture, that 2 is a primitive root modulo infinitely many primes. It is expected, with a predicted density, and proved only under the generalised Riemann hypothesis.
Never more than six times the modulus
For composite moduli the periods multiply up through the least common multiple, and a simple bound holds for all of them.
Peter Freyd and Kevin Brown proved in 1992 that for every , with equality exactly when . The computation shows the bound attained at 10, 50 and 250 and nowhere else up to 1,000. The extreme comes from combining the two most generous moduli: modulo the period is , four times the modulus, because 5 divides the discriminant of and behaves like neither line; and modulo 2 it is 3, a factor of one and a half, which the least common multiple keeps whole because 3 and share no factor. Most moduli sit far below the bound, and the primes on the lower line sit below 1.
The square of a prime
Modulo the period is either or : lifting from to can only multiply the period by or leave it alone. It is natural to expect it always to multiply, and every prime ever tested does.
The test does not iterate steps. Fast doubling computes and modulo in about multiplications, from the identities and , so checking whether and modulo takes a few dozen multiplications of large integers per prime. For all 1,229 primes below 10,000 the answer is no: the period modulo is .
D. D. Wall asked in 1960 whether that is always so. A prime where it fails, with , is now called a Wall–Sun–Sun prime, after Wall and the brothers Zhi-Hong Sun and Zhi-Wei Sun, who showed in 1992 that the first case of Fermat’s Last Theorem could fail for an exponent only if were such a prime. Fermat’s Last Theorem has since been proved by other means, but the question survived it. No Wall–Sun–Sun prime is known; computer searches have gone far beyond the range here; and the heuristic that behaves like a random remainder modulo predicts that they exist, infinitely many and extremely sparse, about of them below .
That is exactly the situation of the two primes where Fermat holds twice, 1093 and 3511, for which modulo rather than merely modulo . The Wieferich condition is about the order of 2 modulo , and the Wall–Sun–Sun condition about the order of ; both ask whether a natural number that is 1 modulo happens to be 1 modulo as well, and both are expected to happen with probability for each prime. For 2 the coincidence has happened twice; for the golden ratio, not yet.
The same period in another disguise
The surprising connection is with a chaotic map. Arnold’s cat map, which scrambles a picture and then always brings it back, acts on a square grid of pixels by the matrix , which is the square of the Fibonacci matrix . Its powers contain Fibonacci numbers, and on an grid the picture returns when those powers are the identity modulo : after half the Pisano period of . A grid of 101 pixels a side, where 101 ends in 1, returns after at most 50 steps; a grid of 103, ending in 3, may need up to 104. The golden ratio’s field decides how long a chaotic map takes to undo itself.
The same arithmetic governs the repeating expansions in the golden-ratio base: a fraction written in base is eventually periodic, and its period is a Pisano period of the denominator. And it is the reason Fibonacci-based random number generators and hash functions have the cycle lengths they do. In each case the object is a power of the matrix , whose eigenvalues are and , and the period is the order of those eigenvalues in whatever finite field the arithmetic happens to be done in.
Two lines and a scatter, not a formula
The figures show periods at particular primes, all computed by stepping the sequence until it returns to 0, 1, and they illustrate a law that is proved, not observed: the divisibility of the period into or follows from Fermat’s little theorem and the Frobenius, as above. What they cannot show is the period itself as a formula. There is none known: the period at is the order of in a finite field, and computing an order needs the factorisation of or and some exponentiation, as for any multiplicative order.
The Wall–Sun–Sun figure is a negative search over a small range. It shows that no such prime lies below 10,000; that none exists at all is a conjecture in the other direction — the heuristic says they exist — and no figure of any size could settle it.
Iterated pairs, fast doubling and quoted theorems
Computed here: the Pisano period of every prime below 10,000 and every modulus up to 1,000, by stepping pairs; the divisibility of each prime’s period into its bound, and the non-divisibility into for the second class; in the field of or elements for nine primes, exactly; the bound and the moduli attaining it; and the test of for all primes below 10,000 by exact fast doubling.
Quoted: Binet’s formula, the theory of finite fields and the Frobenius, quadratic reciprocity (proved in earlier essays), Freyd and Brown’s bound, Wall’s question and the Suns’ theorem, the status of searches for Wall–Sun–Sun primes, and the connection with Artin’s conjecture.
Still open: a Wall–Sun–Sun prime
Is there a prime for which the Fibonacci period modulo equals the period modulo ? None is known, the heuristics say there are infinitely many, and the expected count below grows like , so slowly that a search could run for ever without finding one even if they exist. The analogous question for 2, the Wieferich primes, has two known answers; for the golden ratio there are none, and nothing short of a proof that the remainders are not random can decide it.
A second question is the distribution of the index. The proportion of primes with the full period, and with each smaller period, is predicted by a heuristic of Artin’s kind, refined for the special arithmetic of — for instance, that its order can never be a factor of two short in the second class. The predicted densities agree with the counts here to within the noise of a range this small; proving them, even for the single statement that infinitely many primes have the full period, requires a hypothesis about the zeros of zeta functions that nobody can currently remove.
The Frobenius made visible
The Fibonacci numbers modulo a prime repeat with a period dividing when 5 is a square modulo and dividing when it is not, because the golden ratio then lives in the field of elements or must be adjoined, and in the second case the -th power map swaps it with its conjugate. Every prime below 10,000 obeys the law, most have the full period, and none has a period modulo shorter than times its period modulo .
The period of a sequence that schoolchildren write down is set by the Galois theory of , and the question that remains open about it — whether a Wall–Sun–Sun prime exists — is the golden ratio’s version of the question of Wieferich primes, as stubborn and for the same reason.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A filter that changes only the spread — both name finite field, period
- A growth rate no step contains — both name fibonacci numbers, golden ratio
- Counting in a base that is not a whole number — both name fibonacci numbers, golden ratio
- Give or take twice the square root — both name finite field, quadratic residue
- Newton's method without a derivative — both name fibonacci numbers, golden ratio
- Nineteen thousand bits of state — both name finite field, period
Named objects
A dashed tag is an object no other essay names yet.
Fibonacci numbersField extensionFinite fieldGolden ratioPeriodQuadratic residue