Sixty needs two digits and sixty-one needs ten
Worth reading first: Why the expansion has to repeat · A method that is allowed to miss.
In February 1657 Pierre de Fermat sent a challenge to the mathematicians of Europe: find a whole-number solution of , other than the trivial one. He chose 61 with care. The smallest answer is
and the equations on either side of it are no challenge at all. is solved by , , and by , . Bhāskara II had solved the 61 case five hundred years earlier by the cyclic method that a method that is allowed to miss describes, and he too chose it as a showpiece.
Why should two neighbouring equations differ by eight digits? The existence of a solution is guaranteed for every non-square , and one solution that makes all the others shows that all the others follow from the smallest. Its size is the remaining mystery, and it is a mystery with a precise answer: the smallest solution is the product of the continued fraction’s complete quotients over one period. A long period with large quotients means an enormous solution, and nothing about the size of controls either.
Neighbours that disagree by eight digits
The scatter above shows the first surprise in bulk. Most values of have small solutions: 777 of the 969 non-square up to 1,000 need fewer than ten digits. But the top edge climbs steadily, and the records are spaced irregularly — 61 jumps from five digits to ten, 421 from 23 to 34, and between records the cloud is dense and noisy. There is no smooth function of hiding under it.
Look closely at a run of consecutive values. From 52 to 72, the solutions have 1 to 5 digits except at 61, which has 10. The row of periods printed under the bars tells the same story at a smaller scale: 61’s period is 11, the longest in the run; 67’s is 10 and its solution has five digits; 63, 65 and 68 have periods of 1 or 2 and solutions of one to three digits.
The small ones have a reason that can be seen directly. When is one less than a square, , the solution is , , since . So 63 has and 99 has . When is one more than a square, , the number has norm and its square, , solves the equation: 65 has . Values next to a square are cheap, and the floor of the scatter is made of them — the small scalloped arches visible along the bottom of the second scatter below.
61 is as far from structure as a number between 49 and 64 can be, and it pays for it. The same is true of every record-setter: none sits beside a square.
The solution is a product of the steps
The link between the period and the size is an identity, and it is exact. The continued fraction of is computed as a fraction that never closes computes any continued fraction, by repeatedly taking a whole part and inverting what is left, and the numbers produced along the way are the complete quotients — for , the first is . Why the expansion has to repeat writes each one as a state and shows that the states cycle.
Multiply the complete quotients of one period together. The result is not merely close to the fundamental unit — it is the fundamental unit, or its square root when the period is odd. The reason is a general fact about continued fractions: for any number with convergents ,
Each inversion magnifies the leftover error, and the product of the magnifications is the reciprocal of the error remaining after steps. For at the end of a period, the convergent satisfies , so and the product is exactly .
The figure makes the identity visible. The eleven quotients of have logarithms 0.21, 1.45, 1.31, 0.35, 0.86, 1.02, 0.27, 1.16, 1.60, 0.07 and 2.70, and stacked end to end they reach 10.99 — the logarithm of . Multiplied out exactly, with no rounding anywhere, the product of the eleven numbers is that number itself. Its norm is , because 11 is odd, and squaring it gives the answer to Fermat’s challenge.
Size is length times average step
The identity turns a question about size into a question about length. The logarithm of the fundamental unit is a sum of one term per step of the period, so it is the period’s length times the average logarithm of a complete quotient. Either factor can make a solution large.
For the period has 16 terms, the product lands on directly, and the logarithm is 15.27 — about 0.95 per step, a little below 's 1.0 per step. The last quotient is always the largest: it is , roughly , because the last term of every period is twice the first. So a period of length produces a unit of size roughly times the product of more modest factors, and a long period is what makes a solution enormous.
For a typical real number the average is known exactly, and it is the rate at which the denominators of the best approximations in how close a fraction can get grow. Paul Lévy proved in 1936 that for almost every the denominators of the convergents grow like with , so the average logarithm of a complete quotient is that constant. Quadratic irrationals are not typical — they form a set of measure nothing — but their periods behave like short samples of typical expansions, and the per-step averages for up to 1,000 have a median of about 1.28 — above Lévy’s constant, because in a short period the large final quotient carries a heavy share.
So the problem of size reduces to the problem of period length, which the essay on repetition found scattered below a ceiling of about up to 1,000, with no formula predicting which come close. The solution’s size inherits exactly that irregularity, multiplied by about one per step.
Why the records sit five past a multiple of eight
The records in the first scatter share a remainder. After the small early ones, they are 61, 109, 181, 277, 421, 541 and 661 — every one of them a prime, and every one except 409 leaves remainder 5 on division by 8. That is not a quirk of the range, and the reason is one of the prettiest facts in the subject.
When leaves remainder 1 on division by 4, the ring is not the whole of the integers in its field. The numbers with and both odd are integers too — they satisfy a monic equation with whole coefficients, the point the integers a field contains makes about the golden ratio — and the field’s smallest unit may be one of them. For 61 it is
Pell’s equation cannot see , because its coordinates are not whole numbers. It sees the first power of whose coordinates are, and that power is the cube: , exactly the product of the eleven complete quotients above. The answer to Fermat’s challenge is a cube, and a third of its digits are the price of refusing halves.
Why the cube, always? Reduce the half-integers modulo 2. When is 5 more than a multiple of 8, the result is the field with four elements, whose non-zero elements form a group of order 3; the whole-number ones are exactly those that reduce to 1, and every element cubed reduces to 1. When is 1 more than a multiple of 8, the reduction is two copies of the field with two elements, a unit with odd and would need with the left side a multiple of 8, and no half-integer unit exists. Of the 102 square-free up to 1,000 that are 5 more than a multiple of 8, 77 have a half-integer unit, and for each of them the Pell solution’s logarithm is tripled. The records collect where the tripling happens and where, as the class number formula below requires of a large unit, the class number is small.
How large it can get
Plotted against rather than , the logarithm of the unit fills a wedge. The steepest line from the origin through any point has slope 3.80, reached at , where and . That wedge shape is not a coincidence of the range.
The class number formula is where the shape comes from. For each real quadratic field it relates two quantities that look unrelated — the class number , which counts how badly unique factorisation fails, and the logarithm of the fundamental unit — through a special value of an -function:
up to a constant depending on how sits modulo 4. The -value is never large; it is at most a constant times . So is at most about , and it is near that size exactly when the class number is small. When — which heuristics predict for most prime — the unit is forced to be as large as , and the dashed line of slope 1 is that prediction with the -value set to its typical size.
Seen this way, the huge solution for 61 is not bad luck but good arithmetic. has class number 1, so every scrap of must be carried by the unit. For the field is , since , and its class number is 2, so the budget is shared and the unit is small: it is , and the solution for 60 is its square, . A large unit and a small class number are the same fact. That is the tie two families of solutions ended on, seen from the other side.
The cattle of the Sun
The most famous large solution belongs to a problem written in verse and attributed to Archimedes, rediscovered by Lessing in a Wolfenbüttel manuscript in 1773. It asks for the numbers of bulls and cows, white, black, yellow and dappled, in the herd of the Sun god, subject to seven linear conditions and two more: that the white and black bulls together make a square, and the yellow and dappled bulls a triangular number. In 1880 August Amthor reduced it to
The fundamental solution of is not the difficulty. The continued fraction of has period 92, and the product of its complete quotients is a unit whose has 45 digits. The difficulty is the extra condition: must be divisible by . The first solution’s is even already, so everything depends on 4657.
The powers all solve the equation, and the question is the first with . Reduce everything modulo 4657. Since is not a square modulo 4657 — Euler’s criterion gives — the numbers modulo 4657 form a finite field with elements, in which raising to the power 4657 is the same as conjugating. So , and modulo 4657. The wanted is the order of in that field, and it must divide .
Checking the eight divisors in turn, the first power whose vanishes modulo 4657 is the 2329th, . The solution the herd needs is therefore , and its has digits. Amthor found this in 1880 and worked out that the total herd begins 7766 and runs to 206,545 digits. The whole number was computed in 1965 by Williams, German and Zarnke, and printed out in 1981 — forty-seven pages of it.
The argument is a short tour of a good deal of number theory in one place: Fermat’s little theorem in a field of elements, where the Frobenius power is conjugation; the order of an element dividing the size of the group; and a unit of Pell’s equation whose size comes, as above, from a period of 92 complete quotients.
What the scatter cannot show
The digit counts are exact and the explanation is not. Every point in the scatters is a solution computed and verified in exact arithmetic, and the identity with the complete quotients is checked by multiplying them out. The class number formula is quoted rather than drawn, and no figure computes a class number or an -value, so the claim that the wedge’s top edge belongs to class number 1 is the theory’s, not the picture’s.
The range is small. Up to 1,000 the steepest slope is 3.80, and nothing in the figures says how that number behaves further out. The theory’s bound of order allows it to grow slowly without limit, and whether it does, for infinitely many , is tied to the same unanswered questions about class numbers.
And a digit count is not a computation. Writing down takes 103,273 digits, but finding the exponent took eight trials modulo 4657. The size of the answer and the difficulty of finding it are different things, and the scatter shows only the first. A scatter of the time each solution took to find would look different again: the cyclic method and the continued fraction both take a number of steps proportional to the period, not to the digits, so the 61 case is eleven steps of small arithmetic that happen to end on a large number.
Still open: computing the size without writing it down
The logarithm of the fundamental unit, the regulator, is a small number even when the unit is enormous — for the cattle problem’s unit it is about 237,795, while the unit itself has over a hundred thousand digits. Algorithms since Shanks and Lenstra compute the regulator to any precision without ever writing the unit out, representing it instead as a short product of manageable numbers, and they run in subexponential time in the number of digits of .
In 2002 Sean Hallgren gave a quantum algorithm that computes the regulator in polynomial time, one of the few problems besides factoring and discrete logarithms on which a quantum algorithm is exponentially faster than every known classical one. Whether a classical computer can do it in polynomial time is open. It is believed not — the problem is at least as hard as factoring — but no proof of that exists either, and the question sits alongside factoring as one of the few natural problems on which quantum and classical computation are thought to differ.
The gap is sharpest for exactly the equations this essay has been about. A solution with a hundred thousand digits cannot be printed in polynomial time by anybody, quantum or not, because printing it takes a hundred thousand steps. What can be asked of an algorithm is the regulator, the logarithm, to a stated number of places — a few dozen digits in place of a few hundred thousand — and that is the quantity whose classical complexity is unknown.
A size set by a journey
Neighbouring equations have wildly different first solutions because the first solution is not a function of in any simple sense. It is the product of the steps the continued fraction takes to return to its start, so it is as long as the journey and as large as the steps along it. A number just beside a square returns in one or two steps; 61 takes eleven; 4729494 takes ninety-two, and then the cattle problem asks for the journey to be repeated 2329 times.
When a quantity is a product along a cycle, its size is the cycle’s length times the typical step — and the right question stops being “how large is it?” and becomes “how long is the cycle?”, which here has an honest answer only in the class number formula, and a complete one nowhere.
Two further facts sharpen the answer without completing it. The cycle can be shorter than the unit it produces suggests, when the field has a smaller unit with halves in it that Pell’s equation is not allowed to use; then the solution is a cube, and the records cluster where that happens. And the cycle is long exactly when the class number is small, because the class number formula shares a fixed budget between the two. Fermat chose 61 because it was hard. He could not have known that it is hard because factors uniquely, and because 61 is five more than a multiple of eight.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- The square that cannot shrink — both name continued fractions, pell equation
Named objects
A dashed tag is an object no other essay names yet.
Continued fractionsFundamental solutionGrowth rateLogarithmOrder of an elementPell equationQuadratic irrational