Number

Two neighbours share out their small primes

A number and the next one have no prime in common, and the natural guess is that their largest primes are independent. In the limit that is believed and nearly proved. Below ten million it is visibly false: neighbours are both made of small primes only nine-tenths as often as independence predicts, a run of four only two-thirds as often, and the correlation between their largest primes is negative at distance one and positive at distance six — because a small prime that divides one of two neighbours is a small prime the other cannot have.
18 min read 6 figures Small cases lieOrder out of noise

Worth reading first: The largest prime in a typical number · How many primes a typical number has.

The largest prime in a typical number found that a number’s biggest prime factor follows a law of its own. Write P(n)P(n) for the largest prime dividing nn and measure it as a power of nn, t(n)=log⁡P(n)/log⁡nt(n) = \log P(n)/\log n. Then the share of numbers with t≤1/ut \le 1/u — numbers whose every prime factor is at most the uu-th root of the number — tends to Dickman’s ρ(u)\rho(u): about 31% have no prime factor above their square root, 4.9% none above their cube root.

That essay ended by asking about two numbers at once. A number nn and its neighbour n+1n + 1 have no prime factor in common, since any common factor would divide their difference, which is 1. Nothing in arithmetic seems to tie the factorisation of one to the factorisation of the other, and the natural guess is that t(n)t(n) and t(n+1)t(n + 1) are independent: that the chance both neighbours are square-root smooth is ρ(2)2≈0.094\rho(2)^2 \approx 0.094, the chance that n+1n + 1 has the larger largest prime is a half, and so on.

The guess is believed to be right in the limit. Below ten million — which is as far as a computation that looks at every single number can comfortably go — it is wrong in a way that is easy to see and easy to explain.

The largest primes of n and n + 1, side by side. Joint law of t(n), t(n+1) for 1000≤n<1e7 in 24×24 cells: corner (both near prime) 0 against 44149 expected; other ratios 0.268 to 2.582.
Fig. 1 Every n from 1,000 to ten million, placed by log P(n)/log n across and log P(n + 1)/log(n + 1) up, each cell coloured by the ratio of the pairs that fall there to the number independence would predict from the two margins.

The corner nobody can reach

The most striking cell in the figure is the black one at the top right. A pair lands there when both nn and n+1n + 1 have their largest prime within a few per cent of the whole number — when both are prime, or both very nearly so. Independence, combining the two margins, predicts 44,149 pairs in that cell. There are none.

The reason is the oldest fact about neighbours: one of them is even. An even number is at most half prime — its largest prime factor is at most n/2n/2, so t(n)≤log⁡(n/2)/log⁡nt(n) \le \log(n/2)/\log n, which at ten million is 0.957. Two consecutive numbers can both be prime only if they are 2 and 3. So the corner is not merely thin but empty, and it is the first sign that the two halves of the pair are not drawn independently. Each of them is drawn from Dickman’s law, and the pair is drawn under a constraint the law knows nothing about: between them, nn and n+1n + 1 contain exactly one factor of 2.

The rest of the figure says the same thing in a quieter voice. The blue block at the lower left, where both numbers are smooth, holds as little as a quarter of its independent share. The red strips along the edges, where one number is smooth and the other has a large prime, hold more than their share. Smoothness and roughness are being shared out between the neighbours, rather than handed to each separately.

Both smooth, less often than chance

Two neighbours both made of small primes. u=2: 1000: both 0.04705, one 0.28428, ratio 0.5821; 3000: both 0.05168, one 0.27409, ratio 0.6880; 10000: both 0.05221, one 0.26803, ratio 0.7267; 30000: both 0.05587, one 0.26671, ratio 0.7854; 100000: both 0.05846, one 0.26677, ratio 0.8214; 300000: both 0.06077, one 0.26705, ratio 0.8522; 1000000: both 0.06331, one 0.26834, ratio 0.8793; 3000000: both 0.06550, one 0.27017, ratio 0.8974; 10000000: both 0.06764, one 0.27197, ratio 0.9145 | u=3: 1000: both 0.00000, one 0.08809, ratio 0.0000; 3000: both 0.00033, one 0.07369, ratio 0.0614; 10000: both 0.00100, one 0.06561, ratio 0.2324; 30000: both 0.00117, one 0.05724, ratio 0.3562; 100000: both 0.00090, one 0.05165, ratio 0.3374; 300000: both 0.00097, one 0.04816, ratio 0.4182; 1000000: both 0.00106, one 0.04611, ratio 0.4982; 3000000: both 0.00112, one 0.04499, ratio 0.5540; 10000000: both 0.00116, one 0.04371, ratio 0.6089 | u=4: 1000: both 0.00000, one 0.03504, ratio 0.0000; 3000: both 0.00033, one 0.02734, ratio 0.4460; 10000: both 0.00020, one 0.02010, ratio 0.4950; 30000: both 0.00007, one 0.01470, ratio 0.3085; 100000: both 0.00002, one 0.01191, ratio 0.1410; 300000: both 0.00002, one 0.01044, ratio 0.2139; 1000000: both 0.00001, one 0.00840, ratio 0.1841; 3000000: both 0.00001, one 0.00705, ratio 0.2344; 10000000: both 0.00001, one 0.00640, ratio 0.2633
Fig. 2 The share of n up to x for which n and n + 1 both have every prime factor at most the u-th root of the number, divided by the square of the share for n alone, for u = 2, 3 and 4.

The cleanest measurement divides the share of numbers whose neighbour is also smooth by the square of the share of smooth numbers. If smoothness were independent between neighbours, the ratio would be one. Below ten million it is 0.91 for square-root smoothness, 0.61 for cube-root smoothness and 0.26 for fourth-root smoothness. Asking for smaller primes makes the shortfall larger, because a number whose largest prime is below its fourth root needs a great many small prime factors, and its neighbour is forbidden every one of them.

The mechanism is simple enough to put in a sentence. A number is smooth by being divisible by many small primes; each small prime pp divides one number in pp, but never two consecutive numbers, so if nn has used up its share of 2s, 3s and 5s, n+1n + 1 is guaranteed to have none of them and must build itself from larger primes. Two independent numbers can both be divisible by 2, 3 and 5; two neighbours cannot.

The ratio for square-root smoothness rises steadily — 0.58 at a thousand, 0.73 at ten thousand, 0.82 at a hundred thousand, 0.88 at a million, 0.91 at ten million — and that is the behaviour independence in the limit predicts. As numbers grow, the small primes become a smaller part of every number’s logarithm, and how they are shared out matters less and less to where the largest prime lands. The convergence is slow, like an inverse power of log⁡x\log x, which is why ten million is still visibly short of it. The same slowness made the bell curve of prime factors narrower than its theorem at every size anyone can count: statements about the factorisation of a typical number are true at sizes that grow like exponentials of exponentials, and any table is a snapshot from the foothills.

Which neighbour has the larger prime

Which of two neighbours has the larger prime. Share with P(n) below P(n+1): 100: 0.5253 / log 0.5640, 1000: 0.5105 / log 0.5445, 10000: 0.5009 / log 0.5328, 100000: 0.5008 / log 0.5263, 1000000: 0.5001 / log 0.5218, 10000000: 0.5000 / log 0.5186.
Fig. 3 The share of n up to x for which n + 1 has a larger largest prime factor than n, counted plainly and with each n weighted by 1/n.

Some statistics of the pair are symmetric and ignore the sharing out. Whether P(n)<P(n+1)P(n) < P(n + 1) or the reverse is one of them: whatever constraint links the neighbours, it treats nn and n+1n + 1 alike, so the larger prime should belong to each half the time. The plain share is 0.5000 at ten million. The share weighted by 1/n1/n, which leans on small numbers, is still 0.519, because among very small numbers the larger number tends to have the larger prime.

Even this needed a theorem. Paul Erdős and Carl Pomerance asked in 1978 for a proof that the share is a half, and could prove only that each order occurs a positive proportion of the time. Joni Teräväinen proved in 2018 that the weighted share tends to a half, building on Kaisa Matomäki and Maksym Radziwiłł’s work on multiplicative functions in short intervals and Terence Tao’s on their correlations. Whether the plain, unweighted share tends to a half is still open. The weighted share is the easier target for the same reason it converges more slowly: weighting by 1/n1/n averages over all scales at once, and the tools for multiplicative functions are better at averages over scales than at single long stretches.

The correlation follows the small primes

How much a number's largest prime knows about its neighbours'. Correlation of t(n), t(n+k), k=1..12: -0.05971, -0.02817, -0.02450, -0.01228, -0.02560, 0.00706, -0.02805, -0.00447, -0.01255, 0.00598, -0.03223, 0.02292; mean t 0.64658.
Fig. 4 The correlation between log P(n)/log n and log P(n + k)/log(n + k), over n from 1,000 to ten million, for distances k from 1 to 12.

The sharing-out argument predicts more than a negative correlation between neighbours; it predicts how the correlation should change with the distance. Two numbers a distance kk apart can both be divisible by a prime pp exactly when pp divides kk. At distance 1 they share nothing, and the correlation is the most negative of all, −0.060-0.060. At distance 6 they can both be divisible by 2 and by 3, the two primes that matter most, and the correlation turns positive, +0.007+0.007; at distance 12, with 4 and 3 in common, it is +0.023+0.023. Distances that share only one of 2 and 3 sit between: −0.028-0.028 at 2, −0.025-0.025 at 3, −0.012-0.012 at 4, −0.013-0.013 at 9. The distances coprime to 6 — 1, 5, 7 and 11 — are all among the most negative, at −0.06-0.06, −0.026-0.026, −0.028-0.028 and −0.032-0.032.

So the correlation is not a property of nearness at all. It is a property of shared divisibility, and nearness matters only because nearby numbers have small differences, which have few prime factors. This is the same structure that makes Euclid’s numbers coprime to every prime on their list and that runs through every sieve, including the one written as a product over primes: the residues of nn modulo small primes are independent, and the residues of nn and n+kn + k modulo pp are tied together exactly when pp divides kk.

Neighbours built from small primes only

The extreme case of sharing out is the case where both neighbours are smooth with respect to a fixed bound — not a root of the number, but a fixed set of primes.

Neighbours made only of small primes. y=3: 4 pairs, last (8, 9); y=5: 10 pairs, last (80, 81); y=7: 23 pairs, last (4374, 4375); y=11: 40 pairs, last (9800, 9801); y=13: 68 pairs, last (123200, 123201)
Fig. 5 Pairs of consecutive numbers below ten million in which both have every prime factor at most a fixed bound, with how many there are and the largest pair.

Carl Størmer proved in 1897 that for any finite set of primes there are only finitely many pairs of consecutive numbers built from those primes alone. With primes up to 3 there are four pairs, the last being 8 and 9; up to 5, ten, ending at 80 and 81; up to 7, twenty-three, ending at 4,374 and 4,375, which are 2⋅372 \cdot 3^7 and 54⋅75^4 \cdot 7; up to 11, forty, ending at 9,800 and 9,801; up to 13, sixty-eight, ending at 123,200 and 123,201. A search below ten million finds no more, and it does not need to look further: D. H. Lehmer turned Størmer’s method into an algorithm in 1964 and listed the pairs completely for every bound up to 41, and the lists agree.

The method is the one that solves Pell’s equation. If nn and n+1n + 1 are both built from a fixed set of primes, write n(n+1)n(n + 1) as Dy2D y^2 with DD squarefree and built from the same primes — finitely many choices — and then (2n+1)2−4Dy2=1(2n + 1)^2 - 4 D y^2 = 1, a Pell equation. Each Pell equation has one fundamental solution that generates all the others, and Størmer showed that a consecutive smooth pair can only come from the fundamental solution or very near it, so each DD contributes at most a few pairs. Finitely many DD, finitely many pairs.

There is a famous special case. With only the primes 2 and 3, the pair 8, 9 is a power of 2 next to a power of 3, and Eugène Catalan conjectured in 1844 that it is the only pair of consecutive perfect powers of any kind. Preda Mihăilescu proved it in 2002. Størmer’s theorem is the version where the primes are fixed and the exponents are free; Catalan’s is the version where the exponents are at least two and the primes are free; both say that consecutive numbers resist sharing their structure, and both are about as far from independence as two numbers can be.

Runs get rarer faster than chance

Runs of numbers made of small primes. k=1: 2719733 runs, share 0.271973, independent 0.271973, first at 4; k=2: 676436 runs, share 0.067644, independent 0.073969, first at 8; k=3: 160931 runs, share 0.016093, independent 0.020118, first at 48; k=4: 36621 runs, share 0.003662, independent 0.005471, first at 1518
Fig. 6 The share of runs of k consecutive numbers up to ten million in which every number has its largest prime factor at most its square root, against the k-th power of the share for one number, on a logarithmic scale.

The sharing argument compounds over longer runs. A run of three consecutive square-root smooth numbers needs three numbers that between them contain one or two factors of 2, one factor of 3 at most, and so on, and each must be smooth with what the others leave. The measured rates fall further below independence with each extra number: 0.91 for pairs, 0.80 for triples and 0.67 for runs of four. The first run of three square-root smooth numbers begins at 48 — 48, 49 and 50 — and the first run of four at 1,518.

The same accounting explains a fact that looks like a coincidence in the first figure: the strips where one neighbour is smooth and the other rough are over-filled. If the small primes have gone to nn, then n+1n + 1 is coprime to all of them, and a number coprime to every small prime is more likely than a typical number to have a large prime factor. Sharing out does not destroy smoothness; it moves it from one neighbour to the other.

Why factoring cares about smooth neighbours

Smooth numbers are not a curiosity. The fastest general methods for factoring a large number NN — the quadratic sieve and the number field sieve — work by finding many numbers that are smooth and whose product is a square modulo NN. The quadratic sieve looks at x2−Nx^2 - N for xx just above N\sqrt N, a run of values that are roughly consecutive in size, and keeps the smooth ones. That it can find them fast is the sieve’s whole trick: a prime pp divides x2−Nx^2 - N for xx in two fixed residue classes modulo pp, so the values it divides recur with period pp, and they can be marked without trying a single division — exactly the periodicity that ties nn and n+kn + k together when pp divides kk.

The sharing out measured here is the same phenomenon seen from the other side. When a sieve marks every pp-th value, it never marks two values closer together than pp — at least not for the same residue class — so smooth values come with a definite spacing rather than at random, and the sieve’s yield is governed by how the small primes are distributed across the run, which is a question about correlations of the kind in the figure above. The running time of the quadratic sieve, exp⁡((1+o(1))ln⁡Nln⁡ln⁡N)\exp\big((1 + o(1))\sqrt{\ln N \ln\ln N}\big), is computed from Dickman’s law as though the values were independent, and it is right to leading order for the reason the ratios above approach one: at the sizes that matter for factoring, the small primes are a vanishing part of each number.

Other factoring methods meet smoothness differently. Pollard’s rho method needs no smoothness at all and finds a factor by a collision; his p−1p - 1 method finds a prime pp exactly when p−1p - 1 is smooth, so it succeeds or fails according to the factorisation of the neighbour of the prime it is looking for. Every one of these methods rests on the uniqueness of factorisation, and every one is limited by how rarely numbers of a given size are made of small primes.

Consecutive smooth numbers and the abc question

Størmer’s pairs have a second life. If nn and n+1n + 1 are both made of small primes, then 1+n=n+11 + n = n + 1 is an equation a+b=ca + b = c in which aa, bb and cc have no common factor and the product of the distinct primes dividing abcabc — the radical — is small compared with cc. For 4,374 and 4,375 the radical is 2⋅3⋅5⋅7=2102 \cdot 3 \cdot 5 \cdot 7 = 210, against c=4,375c = 4{,}375; for 123,200 and 123,201 it is 2⋅3⋅5⋅7⋅11⋅13=30,0302 \cdot 3 \cdot 5 \cdot 7 \cdot 11 \cdot 13 = 30{,}030, against c=123,201c = 123{,}201.

The abc conjecture of Joseph Oesterlé and David Masser says that the radical cannot be much smaller than cc: for every ε>0\varepsilon > 0, only finitely many such equations have c>rad(abc)1+εc > \text{rad}(abc)^{1 + \varepsilon}. Størmer’s theorem is the special case where the primes are fixed in advance and the equation is 1+n=n+11 + n = n + 1; the conjecture would extend it to every set of primes at once, with a bound on how large the last pair can be. Whether it is true is disputed in a way that is unusual in mathematics — a claimed proof from 2012 has not been accepted by most of the specialists who have examined it — and the computational evidence, from searches for equations with small radicals, supports it.

What the computations assume

Every number here was found by a sieve that writes, for each nn up to ten million and twelve beyond, its largest prime factor. Nothing in the figures is asymptotic: the ratios are what they are at ten million, and the claim that they tend to one rests on the slow growth already visible and on the heuristic that small primes matter less as numbers grow, not on anything proved. The Størmer lists are complete because Lehmer proved them complete, not because the search stopped at ten million.

The correlations are small — the largest is six hundredths — and they are measured over ten million pairs, so their standard errors are a few ten-thousandths and every one of the twelve is real. Real and small are both worth saying. A model of the factorisations of nn and n+1n + 1 as independent Dickman variables is an excellent model for most purposes at these sizes; it is wrong in a specific, explainable direction, and the explanation says when it will stop being wrong.

Still open: independence in the limit

Do the largest prime factors of nn and n+1n + 1 become independent? The conjecture is that the pair (t(n),t(n+1))(t(n), t(n + 1)) has, in the limit, the joint law of two independent Dickman variables, so that, for instance, both neighbours are square-root smooth for a share ρ(2)2≈0.094\rho(2)^2 \approx 0.094 of nn. It is not known even that this share exists. Lower bounds showing that smooth neighbours, and longer strings of smooth numbers, occur with positive frequency have been proved for various levels of smoothness, by Adolf Hildebrand and by Antal Balog and Trevor Wooley among others; but no one has shown that the share has a limit, let alone that the limit is ρ(2)2\rho(2)^2. The recent methods that settled the logarithmic version of the ordering question are, so far, much better at symmetric questions than at quantitative ones. The question is a two-point version of the large questions of multiplicative number theory, of the same family as whether the bell of prime factors survives on thinner sets, and it is a fair guess that it will be settled by the same tools when they are strong enough.

One prime cannot divide two neighbours

A number and its neighbour share no prime, and that one fact pulls their factorisations apart. Below ten million the corner where both are prime is empty, both are square-root smooth only 0.91 times as often as independence predicts and fourth-root smooth 0.26 times, runs of smooth neighbours fall further below chance as they lengthen, and the correlation between largest primes is negative at distance one and positive at distance six, following exactly the small primes the distance can share. The shortfalls shrink as numbers grow, as independence in the limit requires, and the symmetric question of which neighbour has the larger prime already sits at a half.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A dashed tag is an object no other essay names yet.

CorrelationIndependenceLargest prime factorPell equationPrime factorisationSieveSmooth number