Number

A small quotient for every denominator

Pick a denominator, any whole number. Among the fractions with that denominator, is there always one whose continued fraction has no large entries — whose path down the Stern–Brocot tree never turns the same way more than five times running? Stanisław Zaremba guessed so in 1972, for a reason to do with sampling a square evenly. Every denominator up to a hundred thousand obeys, with only 6, 54 and 150 needing a five. The guess is proved for almost every denominator and not for all, and the reason it ought to be true is a dimension: the reals whose quotients stay at most five fill a set of dimension 0.837, enough to give each denominator thousands of good fractions on average, and the open question is whether averages are kept everywhere.
17 min read 6 figures Decided by exhaustionSmall cases lie

Worth reading first: Every fraction, exactly once · The arcs a line crosses on its way to a number.

Every fraction, exactly once built the Stern–Brocot tree, in which every positive fraction appears once and the path from the root to it is a sequence of left and right turns. The arcs a line crosses on its way to a number read that path as a continued fraction: the lengths of the runs of turns in one direction are the quotients a1,a2,…a_1, a_2, \ldots in p/q=[0;a1,a2,…,an]p/q = [0; a_1, a_2, \ldots, a_n]. A fraction with small quotients is one whose path keeps changing direction, and that essay recorded, as an open question, a conjecture of Stanisław Zaremba: every whole number qq is the denominator of some fraction p/qp/q, in lowest terms, whose quotients are all at most 5.

This essay checks the conjecture for every denominator up to a hundred thousand, measures what makes it plausible, and explains why it is a question about sampling.

Every denominator has a fraction with small quotients. 2:1340 3:1624 4:32 5:3; need 5: 6,54,150
Fig. 1 For each denominator from 2 to 3,000, the smallest bound AA such that some fraction with that denominator has every quotient at most AA. No denominator needs more than five; three need exactly five.

Listing the fractions that keep turning

Testing a denominator directly means trying every numerator and expanding each fraction, which is slow. The figures go the other way: they list every fraction whose quotients are bounded and record the denominators that appear. A continued fraction [0;a1,…,an][0; a_1, \ldots, a_n] has denominator given by the recurrence

qk=ak qk−1+qk−2,q_k = a_k\, q_{k-1} + q_{k-2},

starting from q0=1q_0 = 1 and q−1=0q_{-1} = 0, so a walk that chooses each aka_k from 11 to AA and stops when the denominator exceeds the limit visits every bounded fraction exactly once — provided the last quotient is taken to be at least 2, since […,a,1][\ldots, a, 1] and […,a+1][\ldots, a + 1] are the same fraction and the second form is the one whose largest quotient counts. The walk is a depth-first search of the Stern–Brocot tree that never runs more than AA steps the same way.

With A=5A = 5 and denominators up to a hundred thousand, the walk visits about a quarter of a billion fractions and finishes in a few seconds. Every denominator up to a hundred thousand is hit. For denominators up to 3,000 the hero figure shows the smallest bound each one needs: most need only 2 or 3; thirty-two need 4; three — 6, 54 and 150 — need 5.

The smallest case is easy to check by hand. The fractions with denominator 6 in lowest terms are 16=[0;6]\tfrac16 = [0; 6] and 56=[0;1,5]\tfrac56 = [0; 1, 5], so the best bound for 6 is 5. For 54 and 150 the same holds by longer arithmetic, and those are the only denominators up to a hundred thousand that need 5.

Which bounds miss which denominators

The conjecture is sharp in the sense that 5 cannot be replaced by 4, since 6 needs 5; the question is how much worse the smaller bounds do.

The denominators each bound misses. A=2: 52950 fails; A=3: 38 fails (6,20,28,38,42,54,90,96,150,156,164,216,228,252,318,336,350,384,386,442,508,558,770,876,922,978,1014,1155,1170,1410,1450,1692,1870,2052,2370,3618,5052,6234); A=4: 3 fails (6,54,150); A=5: 0 fails ()
Fig. 2 The number of denominators up to QQ with no fraction whose quotients are all at most AA, for AA from 2 to 5, as QQ grows to a hundred thousand.

With quotients at most 2, more than half of all denominators are missed — 52,950 of the first hundred thousand — and the count grows in proportion to QQ. With quotients at most 3, only 38 denominators are missed, and none larger than 6,234: the list stops growing well before the search ends. With at most 4, only 6, 54 and 150. With at most 5, none. The figure suggests a pattern that is believed and not proved: that for 3 and 4 the exceptions are finite lists, all found, and that for 5 there are none at all. The jump from 2 to 3 is sharp, and it has a reason, which the dimension of the next section supplies.

The exceptions, close up

The three denominators that need 5 are worth looking at. The best fractions with denominator 54 are 1754=[0;3,5,1,2]\tfrac{17}{54} = [0; 3, 5, 1, 2] and its relatives 1954=[0;2,1,5,3]\tfrac{19}{54} = [0; 2, 1, 5, 3], 3554\tfrac{35}{54} and 3754\tfrac{37}{54}, each with a single quotient of 5 and nothing larger; no fraction with denominator 54 avoids a 5. For 150 the best include 29150=[0;5,5,1,4]\tfrac{29}{150} = [0; 5, 5, 1, 4] and 47150=[0;3,5,4,2]\tfrac{47}{150} = [0; 3, 5, 4, 2]. The fractions come in groups of four because of two symmetries of the problem: p/qp/q and (q−p)/q(q - p)/q have essentially the same quotients, and so do p/qp/q and p′/qp'/q where pp′≡±1p p' \equiv \pm 1 modulo qq, which reverses the order of the quotients. Any denominator’s good fractions are closed under both.

The longer list of exceptions for the bound 3 has a visible bias. Of its 38 members, all but one are even — the exception is 1155=3⋅5⋅7⋅111155 = 3 \cdot 5 \cdot 7 \cdot 11 — and 26 are divisible by 3. Denominators with many small prime factors have fewer fractions in lowest terms to choose from, since every numerator sharing a factor with qq is excluded, and the exceptions are concentrated among them. That is the kind of arithmetic bias a pure counting argument ignores and a proof has to handle: the surplus of bounded fractions is an average over all denominators, and denominators with many small factors receive less than their share.

Why there should be enough: a dimension

The reals between nought and one whose continued fraction quotients are all at most AA form a Cantor-like set EAE_A: the golden ratio’s reciprocal is in every one of them, and most numbers are in none. These sets have Hausdorff dimensions, the measure of fractal size that a dimension that is not a whole number introduced, and they have been computed to many places by Oliver Jenkinson and Mark Pollicott: δ2=0.5313\delta_2 = 0.5313, δ3=0.7057\delta_3 = 0.7057, δ4=0.7889\delta_4 = 0.7889, δ5=0.8368\delta_5 = 0.8368.

The dimension controls how many bounded fractions there are. The number of fractions with quotients at most AA and denominator at most QQ grows like Q2δAQ^{2\delta_A}, and the figure measures that growth directly from the walk.

The surplus of fractions over denominators. A=2: 1.0720 vs 1.0626; A=3: 1.4115 vs 1.4113; A=4: 1.5778 vs 1.5779; A=5: 1.6737 vs 1.6737
Fig. 3 The growth exponent of the number of bounded fractions with denominator up to QQ, measured from the counts, against twice the known dimension for each bound. The measurements settle on the predicted values.

The measured exponents — 1.072, 1.412, 1.578 and 1.674 at the largest QQ — agree with 2δA2\delta_A to two or three decimal places. That makes the heuristic plain. There are QQ denominators up to QQ and about Q2δAQ^{2\delta_A} bounded fractions to share among them. If 2δA2\delta_A is barely above 1, as for A=2A = 2, there is about one fraction per denominator, and many denominators get none. If 2δA2\delta_A is well above 1, each denominator gets on average about Q2δA−1Q^{2\delta_A - 1} fractions, a growing number, and it would take a conspiracy for any particular denominator to get none. For A=5A = 5 the average is Q0.674Q^{0.674}, which at Q=100,000Q = 100{,}000 is in the thousands.

Thousands of good fractions for a typical denominator. slope 0.6188; predicted 0.6737; min count for q > 1000: 29.
Fig. 4 For a sample of denominators up to 100,000, the number of fractions with that denominator whose quotients are all at most 5. The counts grow steadily; no denominator past 1,000 has fewer than 29.

The counts grow with an exponent of 0.62 over the range measured, approaching the limiting 0.6740.674 slowly from below, and they are remarkably steady: no denominator above a thousand has fewer than 29 good fractions. The conjecture is that this steadiness never fails.

Why five, and not four

The heuristic does not single out 5. For the bound 4 the surplus is already large — the average number of good fractions grows like q2δ4−1=q0.578q^{2\delta_4 - 1} = q^{0.578} — and the counting argument would predict that every large denominator is covered by fractions with quotients at most 4. The search agrees: past 150, none is missed. The 5 in Zaremba’s conjecture is forced by three small denominators, 6, 54 and 150, not by anything about large ones; it is the smallest bound that works for every qq including the small, and a statement about all large qq would take 4, or by the same reasoning 3, past 6,234.

The bound 2 is the opposite case. Its surplus is so thin — the average number of good fractions grows like q0.063q^{0.063}, which is about two at a hundred thousand — that a large share of denominators get none by chance alone, and the counting heuristic itself predicts that misses never stop. The dimension δ2=0.531\delta_2 = 0.531 is above a half, so in the limit the surplus does grow, but at a rate no computation could see. Between 2 and 3 the dimension jumps from 0.53 to 0.71, and that jump is the jump in the figure of misses.

Rare, and never absent

From the point of view of a single denominator, good fractions are a vanishing minority.

Rarer at every size, and never absent. 11:8.000e-1, 97:3.542e-1, 211:2.286e-1, 383:1.806e-1, 643:1.589e-1, 1031:1.437e-1, 1607:1.196e-1, 2467:1.071e-1, 3761:9.096e-2, 5647:7.598e-2, 8501:7.271e-2, 12697:6.081e-2, 18979:5.680e-2, 28349:4.734e-2, 42239:4.484e-2, 62969:3.770e-2, 93809:3.395e-2
Fig. 5 For primes from 11 to 100,000, the share of fractions with that denominator whose quotients are all at most 5, with the slope the dimension predicts. The share falls to about one in 29 and is never nought.

For a prime denominator near 94,000, about one fraction in twenty-nine has all its quotients at most 5, and the share keeps falling, roughly like q2δ−2q^{2\delta - 2}, because the bounded fractions form a set of dimension less than one inside an interval of dimension one. A fraction picked at random almost always has some large quotient. Zaremba’s conjecture is the statement that the vanishing minority never vanishes completely: a thinning set that, at every denominator, still has members.

That combination — rare in proportion, plentiful in number — is what makes the problem hard. A counting argument shows the average is large; it cannot show the minimum is positive, because a positive average is compatible with zeros scattered among the denominators. The proofs that exist control how the good fractions are distributed among the residues of qq, which is where zeros could hide.

What is proved

Harald Niederreiter proved in 1986 that the conjecture holds for every power of 2, 3 and 5, by an explicit construction that builds good fractions for qq from good fractions for a smaller power. Jean Bourgain and Alex Kontorovich proved in 2014 that it holds for almost every denominator — all but a set of density nought — with the bound 50 in place of 5, using the surplus of fractions measured above together with deep results on how evenly a group generated by the matrices of two matrices that generate the tree spreads its elements among residues. ShinnYih Huang brought the bound down to 5 for almost every qq in 2015. Since then the exceptional set has been shown to be smaller and smaller, but not empty.

The matrices are the bridge between the counting and the arithmetic. A bounded continued fraction corresponds to a product of matrices (a110)\begin{pmatrix} a & 1 \\ 1 & 0 \end{pmatrix} with a≤Aa \le A, and the denominator is an entry of the product. Asking whether every qq is an entry of some such product is asking how completely a semigroup of matrices covers the whole numbers, and the methods that answer it are those of expanders and the spectral theory of thin groups — subjects that grew up long after Zaremba asked his question.

Where the question came from

Zaremba asked it because of a problem in numerical integration that points on a lattice that see almost nothing described. To integrate a smooth periodic function over the unit square, one can sample it at the qq points (k/q,{kp/q})(k/q, \{kp/q\}) for k=0,…,q−1k = 0, \ldots, q - 1: a lattice rule. How well the rule works depends on how evenly the points spread, and in two dimensions the points spread well exactly when p/qp/q has small continued-fraction quotients, since a large quotient means the points line up along a few lines with large gaps between them. A good lattice rule with qq points exists for every qq if and only if every qq has a good pp — which is Zaremba’s conjecture, with “good” made precise by the bound on quotients.

The same evenness appeared in three gaps and no more, where the points {kα}\{k\alpha\} for irrational α\alpha leave at most three different gap lengths, with the gaps most even when α\alpha’s quotients are small — the golden ratio, all of whose quotients are 1, being the best of all. A rational p/qp/q with small quotients is the finite version of that: its multiples spread around the circle as evenly as qq points can, and Zaremba’s conjecture says such a spreading exists for every number of points.

Depth in the tree

The Stern–Brocot tree gives a second way to see what bounded quotients cost. A fraction’s depth in the tree — the number of turns on its path from the root — is the sum of its quotients, a1+a2+⋯+ana_1 + a_2 + \cdots + a_n less one. A fraction with denominator qq and all quotients small has many quotients, about log⁡q\log q of them divided by the logarithm of their typical size, and so it sits deep in the tree; a fraction with one huge quotient sits shallow, reached by a long straight run. The denominator alone does not decide the depth. The fractions 1q\tfrac{1}{q} and q−1q\tfrac{q-1}{q} are reached by a single straight run of length qq, the deepest possible, while the bounded fractions with the same denominator are reached in a few dozen turns.

The fractions that beat every smaller one found that the best rational approximations to a number are the stopping points of its path, and every rational in one sequence listed the tree level by level. In those terms Zaremba’s conjecture says that every level of the tree’s denominators — every qq — is reached by some path that never runs straight for long, and the computations here say that for qq up to a hundred thousand the shortest such path, measured by its longest straight run, never needs a run of six.

A path that never runs long

The figure below shows what a good fraction’s path looks like for one large prime.

A path that never turns the same way for long. 7216/9973: [0; 1,2,1,1,1,1,1,1,2,2,2,2,2,2], largest quotient 2.
Fig. 6 The path from the root of the Stern–Brocot tree to 7216/99737216/9973, the fraction with denominator 9,973 whose largest quotient is smallest. No run is longer than two steps.

For the prime 9,973 the best fraction is 7216/9973=[0;1,2,1,1,1,1,1,1,2,2,2,2,2,2]7216/9973 = [0; 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2], with no quotient larger than 2 — far better than the conjecture asks. Its path zigzags down the tree, never running more than two steps the same way, which is as close to the golden ratio’s perfect alternation as a fraction with this denominator gets. Most of the other 9,971 fractions with denominator 9,973 have paths with long straight runs, and they are the ones a random choice of numerator would produce.

What the search does and does not show

The search is exhaustive up to a hundred thousand: every bounded fraction with denominator in range is visited, and every denominator is checked. The walk itself is cheap because it never wastes a step: each move appends one quotient and computes one new denominator, and the walk abandons a branch the moment the denominator passes the limit, so the work is proportional to the number of bounded fractions, about a quarter of a billion for the bound 5. Checking each denominator separately, by expanding all of its fractions, would cost about half the square of the range instead, five billion expansions for the same answer, and the comparison is a small instance of the subject’s general habit of counting the objects that exist rather than testing every candidate. That establishes the conjecture up to a hundred thousand, which is a small range — computer searches have checked it far beyond, and the result is unconditional only up to their limit. It also establishes, for these sizes, the lists of exceptions for the bounds 3 and 4. It does not establish that those lists are complete. For 3, the last exception found is 6,234, and nothing between there and a hundred thousand, but a denominator in the billions could still fail; the counting heuristic says this is very unlikely, because the average number of good fractions grows like q0.41q^{0.41}, and the theorem that would make it certain does not exist.

The dimensions used in the comparisons are taken from the literature rather than computed here; what the figures compute is the growth exponent of the counts, which agrees with them.

Still open: every denominator

Zaremba’s conjecture is open: no proof covers every denominator, even with a bound larger than 5. What is proved is that the exceptions, for the bound 5, have density nought, and quantitative versions bound how many there can be up to QQ by a power of QQ less than one. Closing the gap requires controlling every single denominator, which means ruling out conspiracies among residues that the averaging methods are blind to. A stronger form, that the bound 4 works for every denominator beyond 150, and the bound 3 for every denominator beyond 6,234, is suggested by the computations and was proposed by researchers who ran them; it is further out of reach still, since the surplus of fractions for those bounds is smaller.

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.

Continued fractionsExhaustive searchHausdorff dimensionLatticeMediantStern brocot tree