The wait for the next sum of two squares
Worth reading first: Almost no number is one · Two squares, and a lattice.
Almost no number is a sum of two squares. Among the numbers up to the share that are falls off like , so it tends to nothing — slowly, but to nothing. A share tending to nothing usually means the members spread further and further apart. The primes behave that way: they thin out like , and the gaps between consecutive primes grow without bound, with a run of a million composite numbers in a row starting at .
Sums of two squares thin out more slowly than primes do, and their gaps are also forced to stay much shorter than anything the density alone would allow. The next sum of two squares after is never more than about away. The proof is two lines of arithmetic, and it has not been improved in eighty years.
Where they sit on the number line
It helps to look before arguing.
Two things are visible at once. The sums of two squares get rarer — twelve in the first row of twenty, seven in the last. And they never leave a long hole. The widest stretch without one below two hundred is 186 to 192, seven numbers, after which 193 = 144 + 49 arrives.
Some of the structure in the picture is the rule about primes: a number is a sum of two squares exactly when every prime that is 3 more than a multiple of 4 divides it to an even power. That rule makes every number of the form unfilled — a whole column-pattern of holes — and makes 21, 22, 24, 27, 28, 30, 31 all fail for their own reasons. It does not by itself say anything about how long a run of failures can last. For that the argument has to find a sum of two squares near any given number, and the rule about primes is no help in finding one: it decides a number presented to it, but it cannot say where the next success lies without factoring every candidate in turn. What is needed is a construction — a way of writing down, from alone, a nearby number that is visibly a sum of two squares because it has been built as one.
The largest square, and then the smallest
Take any . Let be the largest square not exceeding it, so , and write the remainder as . Because is already bigger than , the remainder is at most . That is the first squaring: the distance from down to a square is at most about .
Now do the same thing to , upward. Let be the smallest square at least . The distance from up to is less than , and is about . That is the second squaring.
Put them together: is a sum of two squares, it is at least , and it exceeds by . So
The picture says the same thing geometrically. A sum of two squares is a lattice point, and is a circle of radius . The argument walks out along the -axis to the last lattice column inside the circle, , and climbs that column until it leaves the circle. The circle crosses the column at height , and the first lattice point above is less than one unit further on. How far outside the circle can that lattice point be? Its squared distance from the origin exceeds by less than , and since is small compared with — the column is near the edge — the excess is small too.
The argument is due to R. P. Bambah and S. Chowla, in 1947, and it is the kind of proof that looks as though a little more care would sharpen it. The next section shows that it has room to spare. Nobody has found the care.
Record gaps against the bound
The bound is easy to test, since sums of two squares are easy to sieve for.
Below a million the longest wait is 35 numbers, where the bound allows about 90. More telling than any single gap is the shape of the records: on logarithmic axes a power law would be a straight line, and the dots bend away beneath the bound’s straight line as grows. What they look like is a quantity growing like a power of rather than a power of .
That is also what heuristics predict. If sums of two squares behaved like random numbers of density , gaps would be typically about long and the longest in a range would be of order — a slowly growing function nowhere near . And the true numbers are not random: the rule about primes makes them avoid residue classes, which lengthens some gaps and shortens others in ways the heuristic ignores.
The gap between the proved bound and the observed behaviour is enormous, and it is open. No argument is known that gives a gap of for any . In the other direction, Ian Richards proved in 1982 that gaps as long as about occur infinitely often, so the gaps are genuinely unbounded; between and is a range nobody has been able to narrow.
Why the easy argument is stuck
The two-squarings argument uses only the fact that squares are dense near the scale : the gap between consecutive squares near is about . To do better one would want to choose the first square more cleverly — not the largest square below , but some square for which the remainder happens to be a square itself, or close to one.
There are about choices of , and each remainder is a number of size up to ; the chance that a random such number is within of a square is about . So with tries and a success probability of each, one expects to succeed with of order 1 — a bounded gap, if the remainders behaved like random numbers. They do not behave like random numbers, and proving that enough of them come close to squares is exactly the kind of statement about the distribution of modulo squares that current methods cannot reach. The easy argument takes one try and accepts whatever remainder it gets; every improvement would need to control many tries at once.
A second route would be to use the rule about primes directly — to show that among the numbers just after one of them has all its primes to even powers. That is a sieve problem, and sieves are good at counting how many numbers in a long interval survive and bad at guaranteeing that a short interval contains one. The interval here has length , which is short by the standards of sieve theory. Sieve methods do show that almost every interval of length a power of contains a sum of two squares — the exceptions are rare — but a statement about every interval, with no exceptions allowed, is out of their reach at any length below the fourth root.
The same obstruction, in a different costume, is what separates the count of lattice points in a disc from its expected value. There the question is how far the number of lattice points in a circle of radius can stray from ; the easy bound is of order , the truth is conjectured to be about , and eighty years of work have moved the proved exponent only a little. Lattice points near a circle are hard to control, and a gap between sums of two squares is precisely a thin ring round a circle containing no lattice point at all.
Three in a row, and never four
The strip showed 8, 9, 10 filled side by side, and 16, 17, 18, and 72, 73, 74. Runs of consecutive sums of two squares are worth counting, because one length never occurs.
A run of four consecutive numbers always contains one that is 3 more than a multiple of 4. A square leaves remainder 0 or 1 when divided by 4 — an even number squared is a multiple of 4, an odd one is one more than a multiple of 8 — so a sum of two squares leaves 0, 1 or 2, and never 3. So four in a row is impossible, and the reason is arithmetic on a clock with four hours.
Three in a row is not forbidden by any remainder, and it happens, hundreds of times below a hundred thousand. That runs of three recur without end is a theorem, and it can be seen from a family: , , are three consecutive numbers of which the last two are sums of two squares trivially, and for infinitely many the first is too. Take : then and , and a product of two sums of two squares is again one, so is a sum of two squares. With that gives 80, 81, 82. How often runs of three occur in general — how their count up to compares with what an independence model of the three conditions would predict — has conjectural answers and only partial theorems.
Further out, the same shape
A strip at the start of the number line can mislead, because small numbers are special. So look again ten thousand numbers on.
Two hundred numbers past ten thousand contain fifty sums of two squares, where the first two hundred contained seventy-nine; the thinning is visible, and it is the slow thinning of the density rather than anything faster. The longest hole has grown from seven to thirteen. And the holes are still scattered rather than clustered: most rows have three or four filled cells, and none is empty. That is the qualitative content of the bound — the density falls but the spacing stays even — seen at a scale where the fourth root of is ten rather than four.
The hole from 10,101 to 10,113 is also worth reading closely, because it shows what a gap is made of. Among its thirteen numbers, three are and fail automatically; the rest fail because each has some prime to an odd power — 10,101 is , 10,102 is with — each for its own reason. A long gap is a coincidence of many independent failures, which is why long gaps are rare and why their length grows so slowly.
The same bound for other shapes
The argument used nothing specific to squares beyond the gaps between them. Replace by , or by any sum of two powers, and the same two-step argument gives a gap bound — the largest $k$th power below , then the nearest power above the remainder — with an exponent that depends on the powers. For sums of three squares the question disappears: every number not of the form is one, so the gaps are bounded outright — never more than two numbers in a row are missed, and 111 and 112 are the first such pair. For four squares there are no gaps at all, since every number is a sum of four.
So two squares is the interesting case for a structural reason. With three or more squares the representable numbers have positive density and the gaps are bounded; with two they have density zero, and the question becomes how that zero density is distributed. It is thin but evenly spread, and the easy argument sees only a crude version of the evenness.
There is a version of the question for primes that shows how much the answer depends on the set. The primes are also of density zero, thinning like , and the best proved bound for the gap after is about — a much weaker statement than , for a set that is only a little thinner. The difference is that sums of two squares can be constructed near any number, by the two squarings, while nobody knows how to construct a prime near a given number at all.
What the pictures cannot establish
A million is not large. The record gaps are plotted up to , where is about 14 and is about 32. The two scales are not yet far apart, and the eye can be misled about which curve the dots follow. The claim that the records grow like a power of is a heuristic and an extrapolation, not something the figure proves; the only proved statements are the bound above them and Richards’s bound below.
The first figure’s gap of seven is special. Short ranges have their own record gaps, and a strip of two hundred numbers shows a structure — rows thinning, holes at every — that is qualitatively right and quantitatively nothing like the asymptotic regime.
The run counts are a census, not a density. The bar chart counts runs below a hundred thousand; it establishes that four in a row never occurs there, which the remainder argument proves everywhere, and it shows three in a row occurring often, which the infinite family above guarantees. It does not say how the proportions change as the range grows.
Still open: the true size of the gaps
Two questions are open, and they are the natural next steps.
What is the right exponent? It is conjectured that for every the gap after is eventually less than — that is, smaller than any power — and most likely of order at most. The proved exponent is , from the argument drawn above. Any improvement, to , would be a new result.
How long are the longest gaps, really? Richards’s lower bound of about shows the gaps are unbounded; the heuristics suggest the longest gap up to is of order times a small power of at most. Closing the distance between from below and from above is a problem about the fine distribution of lattice points near circles, and it is not expected to be easy.
Both questions would follow from strong enough information about lattice points in thin annuli — rings between radius and — and that information is exactly what the circle problem lacks. So the two open problems, the gaps and the circle, are one problem seen at two scales: the number of lattice points in a whole disc, and whether a thin ring of it contains any at all.
A thin set that is evenly spread
Sums of two squares are rare in the long run and never far apart. Both statements are true at once because the rarity is so slow — a factor of — and because squares are so dense near any small number that a remainder can always be topped up to one. The argument that shows it takes two squarings and fits on a line, and the fact that nobody has improved it is a measure of how little is known about where lattice points lie near a circle.
It is also a small lesson about the difference between counting and constructing. Landau’s count says how many sums of two squares there are, to a precision the gap bound cannot approach; the gap bound says where one of them is, near any number, which the count cannot say. Each kind of statement is blind to what the other sees, and the best results in this subject are the ones that manage both. Here the count is sharp and the placement is crude, and the eighty-year-old crude one is still the best there is.
Reads more easily once this is understood
Essays that name this one as worth reading first.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- Counting one rectangle, twice — both name lattice, modular arithmetic, primes
- The exponent that is smaller than Euler's — both name exhaustive search, modular arithmetic, primes
- The planes a recurrence cannot leave — both name exhaustive search, lattice, modular arithmetic
- The two squares actually produced — both name lattice, modular arithmetic, sums of two squares
- The two supplements, and where the eight comes from — both name modular arithmetic, primes, sums of two squares
- Which primes a form takes — both name modular arithmetic, primes, sums of two squares
Named objects
A dashed tag is an object no other essay names yet.
AsymptoticDensityExhaustive searchLatticeModular arithmeticPrimesSums of two squares