When minus one can be reached
Worth reading first: One solution that makes all the others · Why the expansion has to repeat.
Pell’s equation has a solution for every that is not a square, and one solution that makes all the others showed that every solution is a power of the smallest. Change the on the right to and the certainty goes. is solved by , by , and by . But has no solution at all, and neither has .
The essay that set up the equation closed on this difference and said that deciding which reach “is not elementary and is still not fully understood”. This essay follows that remark to its end. The answer comes in layers. The first layer is a remainder, and it rules out most outright. The second is a theorem of Legendre’s, and it settles every prime. The third needs the symbols of quadratic reciprocity and then their fourth-power cousins. And under all of them sits a question about how often, which was open for thirty years and was answered by a proof announced in 2022.
A solution of the negative equation is worth having when it exists, because it is half of a solution of the positive one. If then squaring gives a number whose norm is : from comes , which is Fermat’s famous answer for 61 that sixty needs two digits and sixty-one needs ten measured. So the question is also a question about whether the smallest solution of Pell’s equation is a perfect square in disguise.
Two reasons it can fail, both visible from a remainder
Two obstructions are local: each can be seen by reducing the equation modulo a single number.
The first is modulo 4. A square leaves remainder 0 or 1 on division by 4, so leaves 1 or 2. If divides then leaves 0, and cannot hold. No search is needed.
The second is modulo a prime. If divides , the equation says , so must be a square modulo . For an odd prime that happens exactly when leaves remainder 1 on division by 4 — the same condition that decides which primes a form takes when the form is — and it is the first of the two supplements to quadratic reciprocity, and it follows from Euler’s criterion: is a square modulo when . So any prime of the form dividing blocks the equation. , , , , , , , , and all fall to one of these two tests.
The grid sorts all 399 values of from 2 to 400. Nineteen are squares. Of the rest, 302 are blocked by one of the two remainders, 69 are solvable, and 9 are neither: nothing modulo any single number forbids a solution, and still there is none. Those nine are , , , , , , , and .
The picture is lopsided in a way that matters later. The obstructions are common: most numbers have some prime factor of the form , and a quarter are divisible by 4. What is left is thin — a set of whose density among all numbers tends to zero, since having no prime factor of the form is a condition that becomes rarer the more factors a number has. The whole interesting question lives inside that thin set. Up to 400, 78 values of escape both obstructions, and 69 of them are solvable.
The test used to decide solvability is the one from the equation’s first essay: has a solution exactly when the continued fraction of has an odd period. Why the expansion has to repeat explained the period; its parity is the switch. After one full period the convergent satisfies , where is the period’s length, so an odd period hands over a solution of the negative equation on the spot and an even one never does. That turns a search with no bound into a finite computation, and the grid is the output of 399 such computations.
Every prime of the form 4k + 1 gets there
For a prime , the two obstructions leave only the primes that are 1 more than a multiple of 4, and Legendre proved in 1785 that all of them are solvable. The argument uses nothing but the positive equation and the fact that its smallest solution is the smallest.
Let be the smallest solution of . Then is odd: if it were even, would leave remainder 3 on division by 4, while with leaves 0 or 1. So and are consecutive even numbers, and writing and gives two consecutive whole numbers and , with no common factor, whose product is times a square. Two coprime numbers whose product is times a square must be a square and times a square, in one order or the other.
If and , then , and is far smaller than — contradicting the choice of the smallest solution. So the other order holds: and , and then . The negative equation is solved, and its solution was hidden inside the positive one’s.
The figure checks the theorem on every prime up to 3,000, and it shows what the theorem does not say. The period’s parity is fixed by the residue of modulo 4, but the period’s length is not fixed by anything visible: primes of similar size have periods of 1 and of 80. The length is what sixty needs two digits and sixty-one needs ten tied to the size of the solution, and it is wild. The parity is tame. One quantity can be controlled completely while another quantity computed from the same expansion cannot be controlled at all.
The primes of the form are the other half of the same picture, and every one of them has an even period, as the modulo-4 argument says it must. Between them the two families account for every prime, which is why primes are the easy case.
Thirty-four, which passes every test and still fails
The first in the grid that is neither blocked nor solvable is 34. Its prime factors are 2 and 17, and 17 is 1 more than a multiple of 4, so is a square modulo 17 () and modulo 2. No remainder rules it out.
Something stronger is true: the equation has a solution in fractions. , and dividing by gives . In general can be solved in rational numbers exactly when is a sum of two squares, which is the same as saying that no prime of the form divides it to an odd power — the fact two squares, and a lattice proves for primes. So on the thin set every has a rational solution, and the question is purely whether a whole-number one exists. For 34 it does not.
The convergents show it directly. The period of is , four terms, and the values at the convergents cycle through . The equation comes within of the target and then turns back. Every solution of would have to appear among these convergents, because any fraction that close to is one, and they never produce it.
The rational solution explains the near miss: , a square times , and , again a square times . The equation keeps reaching multiplied by a square and cannot shed the square. The reason lives in the ring . The ideal generated by is the square of an ideal of norm 5, and that ideal is not generated by any single number: if it were generated by some , then would be a whole-number solution of the negative equation. That is a fact about the class group, the object two families of solutions, and a box met when it counted families, and no remainder modulo a single number sees it.
Two primes, and a rule that looks one level deeper
Legendre’s argument for primes almost works for a product of two. Take with and both of the form , and the smallest solution of the positive equation. As before is odd and , are coprime with product times a square. Now there are four ways to split: in either order, or in either order.
Two of the four are the prime case again: one gives a smaller solution of the positive equation, which is impossible, and the other gives . The two new cases give . Reduce either modulo : it says , so is a square modulo , since is one. If is not a square modulo , both new cases are impossible, and the negative equation has a solution. That is the result the Legendre symbol decides, and because both primes are of the form , reciprocity — which counting one rectangle, twice proves by counting lattice points — makes the condition symmetric: is a square modulo exactly when is a square modulo .
When is a square modulo , the argument stops, and the answer really does depend on more. Arnold Scholz found in 1934 what it depends on: whether each prime is a fourth power modulo the other. When one is and the other is not, the equation has no solution. When neither is, it always does. And when both are, the fourth powers do not decide it.
The figure sorts all 714 such products up to 20,000, and the four groups behave exactly as the two rules predict. Three of them are uniform — 370 of 370, 0 of 183, 88 of 88 — and the fourth is mixed, 25 of 73. Below that fourth group the arithmetic goes on: eighth powers, and then a tower of finer symbols that László Rédei began to study in the 1930s. Each layer decides some cases and hands the rest to the next.
The same shape appears when 2 is one of the primes. For , the question is whether 2 is a square modulo , and the second supplement says that happens exactly when leaves 1 or 7 on division by 8. Among primes of the form below 5,000, every one that leaves 5 on division by 8 gives a solvable — 168 of 168 — while among those that leave 1, only 54 of 161 do. 34 is , and 17 leaves 1.
Most numbers with no obstruction have few prime factors
The prime case is certain, the two-prime case is decided by a coin that lands two ways out of three, and more factors mean more layers. That is why the answer to “how often” depends so heavily on how many prime factors a typical has.
Up to a million there are 124,490 squarefree in the thin set. Almost a third of them — 39,176 — are primes or , and every one of those is solvable. Of the 55,163 with two prime factors, 66.7% are solvable. Three factors give 71.7%, four give 67.4%, five give 66.3%, and there are only 172 numbers with five. Six is not reached at all before a million.
The shares do not fall in a straight line: three factors do better than two. But the drift away from certainty is clear, and it is driven by the composition of the set. A typical number up to has about prime factors, and in the thin set about half that, because each prime has to be of the form . At a million, is about 2.6 — so the thin set is dominated by numbers with one or two prime factors, exactly the cases in which a solution is most likely.
A limit reached at the pace of log log
In 1993 Peter Stevenhagen proposed a model of the part of the class group made from elements whose order is a power of 2, and from it a precise prediction: among in the thin set, the share for which is solvable tends to
The product runs over and converges quickly: the first factor alone is , the first two give , and a few more settle it at . Étienne Fouvry and Jürgen Klüners proved in 2010 that the true share, whatever it is, eventually lies between about 52.4% and 66.7%. In 2022 Peter Koymans and Carlo Pagano proved that the limit exists and is exactly Stevenhagen’s number.
The computed share is nowhere near it. At a thousand it is 84.7%, at ten thousand 82.4%, at a hundred thousand 79.8%, and at a million 78.2%. The curve is falling, and it is falling towards the dashed line, but on a scale where every step to the right multiplies by ten it has covered about a quarter of the distance.
The previous section is the reason. The share is a weighted average of the per-factor shares, weighted by how many have each number of factors, and those weights shift only as fast as grows. To get a typical member of the thin set up to five or six prime factors, would need to reach ten or so, which puts beyond , a number with nearly ten thousand digits. No computation will ever show this curve arriving. The limit is a theorem about numbers no one will write down, and the data at every size anyone can reach says something else.
That is not a flaw in the theorem or in the data. It is a warning about what data from small cases can say when the quantity that governs the behaviour grows like . A reader who plotted this curve and extrapolated would guess a limit near 70%, and would be wrong by twelve points about a question that was, for thirty years, open.
Still open: whether p ever divides the answer
For a prime of the form , Legendre’s theorem guarantees the negative equation a solution , and the smallest one can be enormous: below 100,000, one needs an with 362 digits. In 1952 Nesmith Ankeny, Emil Artin and Sarvadaman Chowla conjectured something small about it — that never divides . Put another way, the solution is never secretly times something simpler.
There is a reason to care beyond the curiosity. The three proved a congruence tying the smallest solution to the class number of and to the Bernoulli number , and through it the conjecture is equivalent to not dividing the numerator of that Bernoulli number — a statement about a sequence defined with no reference to Pell’s equation at all. For every prime of the form below 100,000 — 4,783 of them — the solution computed from the continued fraction of has not divisible by . The conjecture has been checked by others far beyond that, past .
No proof is known, and the heuristic points the other way. If behaved like a random number, it would be divisible by with probability about , and the sum of over primes diverges. So a random model predicts infinitely many exceptions, spaced so sparsely that the first might lie far beyond any computation. Whether the conjecture is true, and the model is missing some structure, or false, with its counterexamples out of reach, is unknown. It is the same situation as the density curve above: an answer that the numbers anyone can compute do not decide.
What the pictures do not settle
Each figure is a finite check. The grid tests the parity of 399 periods, the primes figure 429, the two-prime figure 714 products, and the density curve 124,490 values of . Legendre’s theorem and the two-prime argument are proved above, not just tested; Scholz’s rule, the rational-solution criterion and the limit theorem are quoted, and the figures are consistent with them on every case drawn.
The period-parity test itself rests on another theorem of Legendre’s: every fraction close enough to to satisfy is a convergent, so a search through one period sees every candidate. The convergents shown for 34 therefore settle 34; they do not illustrate a pattern, they exhaust the possibilities.
Which in the thin set fail is decided by structure that no finite list of remainders captures. The first layer uses squares, the next fourth powers, the next eighth powers, and every layer leaves a remainder of cases for the next. What the 2022 proof shows is that averaged over all this infinite tower has a well-defined result, and that the result is Stevenhagen’s 58%. A single can still need an arbitrary number of layers to decide, and the continued fraction, which decides it in a few steps, gives no hint of which layer did the work.
What links here
Computed from the collection, not written here: the essays that point at this one.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A method that is allowed to miss — both name continued fractions, fundamental solution, pell equation
- A fraction that never closes — both name continued fractions, periodicity
- Give or take twice the square root — both name legendre symbol, quadratic residue
- How often two generates every remainder — both name density, quadratic residue
- One sum, squared two ways — both name legendre symbol, quadratic residue
- The pattern in e's continued fraction — both name continued fractions, periodicity
Named objects
A dashed tag is an object no other essay names yet.
Continued fractionsDensityFundamental solutionLegendre symbolPell equationPeriodicityQuadratic residue