Zaremba's conjecture at bound 5 for powers of 7
Result page Proof blueprint → Paper PDF Verification archive
Run Euclid's algorithm on 7ⁿ and a number a between 0 and 7ⁿ that 7 does not divide. Lean proves that some such a keeps every quotient at most 5 when n, halved until it is odd, is at most 41, and when n is 43 or 86.
For every n ≥ 1 whose odd part (n divided by the largest power of 2 that divides it) is at most 41, and for n = 43 and n = 86, there is an a with 0 < a < 7ⁿ, sharing no factor with 7ⁿ, such that every partial quotient of the canonical continued fraction of a/7ⁿ (the one Euclid's algorithm gives, whose last quotient is at least 2) is at most 5.
Zaremba conjectured that every q ≥ 2 has such an a with every quotient at most 5. For powers of 7, Shulga (2024) proved bound 6 for every 7ⁿ and Komatsu (2005) proved bound 3 for odd parts 1 to 11, while bound 5 for every power of 7 is still open. Here 21 explicit fractions, one per odd part up to 41, are checked by Lean, and a folding step that squares the denominator carries each of them to 7 to the power c·2ʲ for every j.
Checked witnesses and shape-keeping folds give bound 5 for 7ⁿ, n ≥ 1, when the odd part of n is at most 41, and for n = 43 and 86
Walkthrough: 4 of 4 main results in Lean; one clause of Theorem 1, on a second 1-fold, is no Lean declaration
Lean re-proves only the parts the paper uses, each named in its line below; no outside theorem is assumed. Dubno’s powers of 12 and 18 and Shulga’s bound for q other than powers of 7 are not in Lean. Lean checks the seeds 5/7 and 30/49 as fractions; that they are Komatsu’s is taken from the paper.
Published inputs
- Mendès France (1973) (not fully read) (Re-proved in Lean): Proved the folding identity relating the expansions of a/q and a/q + 1/(q²x). Lean re-proves the form the paper states as Lemma 3(1), for z ≥ 1 and q ≥ 2.
- Dubno (2024) (Re-proved in Lean): The paper credits Dubno with shape S1 (both end quotients strictly between 1 and k) and its preservation under z-folds and repeated doubling; he settled bound 5 for powers of 12 and 18. Lean re-proves the preservation for k ≥ 3 and 1 ≤ z ≤ k + 1, and the doubling, but not the powers of 12 and 18.
- Komatsu (2005) (Re-proved in Lean): Proved bound 3 for 7 to the power c·2ʲ for every j ≥ 0 and c ∈ {1, 3, 5, 7, 9, 11} via shape S2 doubling (the paper credits shape S2 and its doubling to Komatsu); his 5/7 covers 7 and his 30/49 covers 7 to the power 2ʲ for every j ≥ 1. Lean re-proves S2 doubling under the 1-fold (z = 1) and bound 3 for these c, within its bound 3 for odd parts up to 13.
- Shulga (2024) (Re-proved in Lean): His radical bound K(a/q) ≤ rad(q) − 1 (rad(q) is the product of the distinct primes dividing q) gives bound 6 for every 7ⁿ. Lean re-proves only the powers-of-7 case, bound 6 for every 7ⁿ with n ≥ 1, not the bound for other q.
What this paper adds
- Folding lemmas & the odd-power obstruction (Lemma 3): The classical z-fold; Twisted folds, described by a whole number t; For z = 7ʲ with j ≥ 1, a bound-5 tail needs t ≥ 2; No classical fold lands on an odd power of 7 at bound 5
- Shape-keeping folds & doubling (Proposition 4): A z-fold with 1 ≤ z ≤ k + 1 keeps shape S1 at bound k; S2 words double too; Bound 6 for every 7ⁿ, n ≥ 1
- Checked witnesses (Theorem 1 & Proposition 2): 21 S1 witnesses, each doubled for every j; 47 witnesses for 7⁴³, and one fold to 7⁸⁶; Bound 4 for 7ⁿ, n ≥ 1, when the odd part of n is at most 15; Bounds 3 and 2
Bound 5 for 7ⁿ, n ≥ 1, when the odd part of n is at most 41, and for n = 43 and 86
For every n ≥ 1 whose odd part (n with every factor 2 divided out) is at most 41, and for n = 43 and n = 86, some a with 0 < a < 7ⁿ, not divisible by 7, has every partial quotient of a/7ⁿ (the numbers Euclid’s algorithm produces) at most 5; so every n from 1 to 44 is covered.
4 of 4 main results (Theorem 1, Proposition 2, Lemma 3, Proposition 4) proved in Lean with no outside assumption, but for one clause of Theorem 1, its remark that a second 1-fold of the 7⁸⁶ witnesses brings in an entry 6, which no Lean theorem states; the searches that found the witnesses are outside Lean.
Listed as open in the paper
- An S1 witness at bound 5 for 7⁴³, which would settle 7 to the power 43·2ʲ for every j ≥ 0, starting with n = 172.
- Settling n = 45, the least exponent the paper leaves unsettled at bound 5, as well as n = 17 at bound 4 and n = 15 at bound 3.
- Bound 5 for every 7ⁿ at once; by Lemma 3(2), any inductive proof for all odd exponents must go beyond classical folds with t = 1.
Adjacent prior work (not used as inputs)
- Zaremba (1972) (not fully read): Conjectured that every q ≥ 2 has a numerator a sharing no factor with q whose partial quotients are all at most 5, in the setting of good lattice points for numerical integration.
- Bourgain & Kontorovich (2014); Huang (2015): Proved the conjecture for a density-one set of denominators, at bound 50 and then at bound 5; such results leave sparse sequences like 7ⁿ untouched.
- Niederreiter (1986) (p. 310 unread); Yodphotong & Laohakosol (2002) (not fully read): Niederreiter proved bound 3 for every 2ⁿ and 3ⁿ and bound 4 for every 5ⁿ; Yodphotong and Laohakosol proved bound 5 for every 6ⁿ.
- Ayadi & Komatsu (2024) (not fully read): Treat q to the power 2ʲ for q ≤ 100 and values of recurrence polynomials, which the paper says meets powers of 7 only at odd part 1; the paper read only the published abstract.
- Shkredov (2026) (proofs not checked); Zhang (2026) (proofs not checked): Recent preprints with large bounds. Shkredov proves a large computable bound for prime and square-free q and for pⁿ with n large, and Zhang (unrefereed) claims a large absolute bound for all q and states that reaching 5 needs an additional idea.
From 2/7 to 15/49, and why 7³ needs a different start
Euclid on 7 and 2: 7 = 3·2 + 1 and 2 = 2·1, so 2/7 = [0; 3, 2]. The quotients 3 and 2 are at most 5, and both ends lie between 2 and 4.
Folding with z = 1 writes the word, then 0, 1, then the word backwards with its last entry lowered by 1: 3, 2, 0, 1, 1, 3. Merging the 0 into its neighbours gives 3, 3, 1, 3. Check by Euclid: 49 = 3·15 + 4, 15 = 3·4 + 3, 4 = 1·3 + 1, 3 = 3·1, so [0; 3, 3, 1, 3] = 15/49 = 2/7 + 1/49. Folding again gives 736/7⁴ = [0; 3, 3, 1, 4, 2, 1, 3, 3].
Folding 2/7 with z = 7 instead gives [0; 3, 2, 6, 1, 1, 3] = 99/343, which contains a 6. For 7³ the table uses 72/343: 343 = 4·72 + 55, 72 = 1·55 + 17, 55 = 3·17 + 4, 17 = 4·4 + 1, 4 = 4·1, so 72/343 = [0; 4, 1, 3, 4, 4], all at most 5 with both ends between 2 and 4.
Quotients, witnesses and boundary shapes
Euclid's algorithm on q and a lists the partial quotients of a/q, and K(a/q) is the largest of them. A Zaremba witness for q at bound k is an a with 0 < a < q, sharing no factor with q, and K(a/q) ≤ k. Two shapes of word double well: S1 is a canonical word of length at least 2, every entry at most k and both ends from 2 to k − 1, and S2, for k ≥ 3, is a canonical word of length at least 3, every entry at most k, starting 1, 1 and ending in 2. The odd part of n is what is left after dividing out every factor 2.
- A Zaremba witness for q at bound k
- The largest partial quotient K(a/q)
- The canonical word of a/q
- Euclid's quotients, step by step
- One step of Euclid
- The largest entry
- The largest entry of two words joined
- Reversing keeps the largest entry
- The largest entry is at most k exactly when every entry is
- Every entry is at most the largest
- The empty word's largest entry
- The value of a word
- A positive word
- A canonical word
- The other expansion
- The two expansions of 5/6
- Shape S1 at bound k
- Shape S2 at bound k
- An S1 witness for q at bound k
- An S2 witness for q at bound k
- An S1 witness is a Zaremba witness
- An S2 witness is a Zaremba witness
- The odd part of n
- Odd part times the power of 2 gives n back
- The odd part is odd
- The odd part of c·2ʲ
- The last entry of a one-entry word
- The last entry after adding one at the end
- The last entry is decided by the end
A word is a product of matrices
A word (a₁, …, aᵣ) stands for the matrix product M(a₁)⋯M(aᵣ), where M(c) has rows (c, 1) and (1, 0). Its first column is (q, a) when the word's continued fraction is a/q, and its determinant is ±1, so a and q share no factor. A canonical word is exactly the word Euclid's algorithm gives for its fraction, and every fraction a/q with q ≥ 2 has just one other expansion, ending in 1. Merging zeros and tidying a trailing 1 never change the fraction.
A canonical word is the word Euclid gives
For a canonical word w whose matrix has first column (q, a): 0 < a < q, a and q share no factor, Euclid's algorithm on a/q gives exactly w, and [0; w] = a/q.
- A 2 × 2 matrix of whole numbers
- The identity matrix, whole numbers
- The matrix of one quotient, whole numbers
- Multiplying two matrices, whole numbers
- The transpose, whole numbers
- A whole-number matrix read as an integer matrix
- The identity on the left, whole numbers
- The identity on the right, whole numbers
- Matrix products can be regrouped, whole numbers
- The identity is its own transpose, whole numbers
- M(k) is symmetric, whole numbers
- Transposing a product, whole numbers
- A 2 × 2 matrix of integers
- The identity matrix, integers
- The matrix of one quotient, integers
- Multiplying two matrices, integers
- The determinant
- The transpose, integers
- The matrix of a word
- The matrix of a word of integers
- A quick first column
- Zero merging, one pass
- Zero merging
- Merging a final 1
- Tidying a word
- Running denominators, step by step
- The convergent denominators
Folding a word, and what folding cannot do
The z-fold of a word of length r for a/q is the word, then z − 1 and 1, then the word backwards, starting from its last entry lowered by 1, zeros merged. For a positive word with q ≥ 2 and z ≥ 1 it expands a/q + (−1)ʳ/(zq²) in lowest terms, with denominator zq², and its largest entry is known exactly when the last entry is at least 2. A twisted fold keeps the word and adds any tail. Lean describes every such tail through a whole number t, and for z = 7ʲ with j ≥ 1 shows that t = 1 forces an entry 7ʲ − 1 ≥ 6, that a tail at bound 5 needs t > 7ʲ⁻¹, and that no classical fold onto an odd power of 7 stays at bound 5.
The classical fold (Lemma 3)
Let w be a non-empty word of positive entries, of length r, whose matrix has first column (q, a), so that [0; w] = a/q, with q ≥ 2, and let z ≥ 1. Then the z-fold of w is a word of positive entries with denominator zq² and numerator zaq + (−1)ʳ; that numerator lies strictly between 0 and zq² and shares no factor with zq²; and the fold expands a/q + (−1)ʳ/(zq²).
theorem ZarembaPowersOf7.lemma3_classical_fold {w : List ℕ} {a : ℕ} {q : ℕ} {z : ℕ} (hw : IsPosWord w) (hq : (wordMatN w).a = q) (ha : (wordMatN w).c = a) (hq2 : 2 ≤ q) (hz : 1 ≤ z) : IsPosWord (foldWord w z) ∧ (wordMatN (foldWord w z)).a = z * q ^ 2 ∧ ↑(wordMatN (foldWord w z)).c = ↑z * ↑a * ↑q + (-1) ^ w.length ∧ 0 < (wordMatN (foldWord w z)).c ∧ (wordMatN (foldWord w z)).c < z * q ^ 2 ∧ (wordMatN (foldWord w z)).c.Coprime (z * q ^ 2) ∧ cfVal (foldWord w z) = ↑a / ↑q + (-1) ^ w.length / (↑z * ↑q ^ 2)- The z-fold of a word
The matrix of a fold
For a positive word w with matrix W and z ≥ 1, the matrix of the z-fold of w, read as integers, is W times the matrix with rows (z, −1) and (1, 0) times the transpose of W.
The largest entry of a fold
Let u have entries at least 1, ℓ ≥ 2, z ≥ 1 and w = u followed by ℓ. If z ≥ 2, the largest entry of the z-fold of w is the larger of the largest entry of w and z − 1. If z = 1, it is the larger of the largest entry of u and ℓ + 1.
Which fractions over zq² extend a word
Let w be a positive word whose matrix has entries q, q′ (top row) and a, p′ (bottom row), with q ≥ 2, and let z ≥ 2. A positive word u exists such that w followed by u has first column (zq², A) if and only if A = azq − t(aq′ − p′q) for some whole number t ≥ 1 with t(q + q′) < zq that shares no factor with zq.
With t = 1, (7ʲq − q′) over q rounds down to 7ʲ − 1
For a positive word with denominator q ≥ 2 and top-right matrix entry q′, and j ≥ 1, (7ʲq − q′) divided by q, rounded down, is 7ʲ − 1, and 7ʲ − 1 ≥ 6.
If (7ʲq − tq′) over tq rounds down to at most 5, t > 7ʲ⁻¹
For a positive word with denominator q ≥ 2 and top-right matrix entry q′, and for j ≥ 1 and t ≥ 1 with t(q + q′) < 7ʲq: if (7ʲq − tq′) divided by tq, rounded down, is at most 5, then t > 7ʲ⁻¹, t ≥ 2, and t > 7ʲ/(6 + q′/q), which is more than 7ʲ/7.
No classical fold reaches an odd power of 7 at bound 5
If w is a positive word for a/q with q ≥ 2, z ≥ 1, n is odd and zq² = 7ⁿ, then the fraction the z-fold expands, over 7ⁿ, has a canonical partial quotient of at least 6.
Folding keeps the shape, so one witness doubles forever
If a word has shape S1 at bound k ≥ 3 and 1 ≤ z ≤ k + 1, its z-fold is already canonical, has shape S1 at bound k, begins and ends with the word's leading entry, and has denominator zq². Folding with z = 1 again and again sends an S1 witness for q to one for q to the power 2ʲ, for every j. The same holds for shape S2 after tidying the fold. From 2/7 = [0; 3, 2], folds with z = 1 and z = 7 reach every 7ⁿ with n ≥ 1 at bound 6.
A fold keeps shape S1 (Proposition 4)
If w has shape S1 at bound k ≥ 3 and 1 ≤ z ≤ k + 1, then the z-fold of w has shape S1 at bound k, is left unchanged by tidying (so it is already canonical), begins and ends with the leading entry of w, and has denominator z times the square of the denominator of w.
theorem ZarembaPowersOf7.prop4_s1_preservation {w : List ℕ} {k : ℕ} {z : ℕ} (hs1 : IsS1 w k) (hk : 3 ≤ k) (hz1 : 1 ≤ z) (hzk : z ≤ k + 1) : IsS1 (foldWord w z) k ∧ canonicalize (foldWord w z) = foldWord w z ∧ (foldWord w z).headD 0 = w.headD 0 ∧ (foldWord w z).getLastD 0 = w.headD 0 ∧ (wordMatN (foldWord w z)).a = z * (wordMatN w).a ^ 2From 7ᶜ to 7 to the power c·2ʲ, shape S1
If k ≥ 3 and 7ᶜ has an S1 witness at bound k, then for every j ≥ 0 so does 7 to the power c·2ʲ.
A tidied 1-fold keeps shape S2
If w has shape S2 at bound k, its tidied 1-fold has shape S2 at bound k and denominator the square of the denominator of w.
Bound 6 for every power of 7
For every n ≥ 1, 7ⁿ has a Zaremba witness at bound 6.
The witnesses Lean checks at bound 5
Table 1 lists, for each odd c from 1 to 41, a numerator for 7ᶜ; Lean's table holds its word as well, and Lean runs a check that each word has shape S1 at bound 5 and first column (7ᶜ, a). A second table lists 47 words for 7⁴³, each starting with 5, of lengths 90 to 111, with every quotient at most 5. Lean runs a check on every row: the word has first column (7⁴³, a), every entry from 1 to 5, last entry at least 2 and leading entry 5, and a satisfies the arithmetic identity the row records. Since each starts with 5, none of these 47 has shape S1 at bound 5.
Every row of Table 1 passes the S1 check at bound 5
Lean runs the S1 check on every row (c, a, w), with q = 7ᶜ and k = 5, and every row passes.
- The S1 check
- The canonical-word check
Passing the S1 check is enough
If a word passes the S1 check for q, a and k, it has shape S1 at bound k, its matrix has first column (q, a), 0 < a < q, a and q share no factor, Euclid's word of a/q is this word, and K(a/q) ≤ k.
- Table 1, the 21 rows for bound 5
An S1 witness at bound 5 for 7ᶜ, every odd c ≤ 41
For every odd c ≤ 41, 7ᶜ has an S1 witness at bound 5.
- A row for 7⁴³
- The 47 rows for 7⁴³
- The check for a row for 7⁴³
Every row for 7⁴³ passes its check
Lean runs the row check on all 47 rows for 7⁴³ (a equals p·7 to the power (m + j), minus or plus t, the canonical-word check for 7⁴³ at bound 5, 7⁸ and 7ᵐ among the convergent denominators, length 90 to 111 and leading entry 5), and every row passes.
The 47 are bound-5 witnesses, none of shape S1 at bound 5
For every row, 0 < a < 7⁴³, a shares no factor with 7⁴³, Euclid's word of a/7⁴³ is the row's word, K(a/7⁴³) ≤ 5, and that word does not have shape S1 at bound 5.
Bound 5 for odd parts up to 41, and for 43 and 86
Write n = c·2ʲ with c odd. If c ≤ 41, the table's S1 witness for 7ᶜ, folded j times with z = 1, is a bound-5 witness for 7ⁿ. For n = 43 any row of the second table will do. Exactly 40 of its 47 words end in a quotient at most 4, and the proof folds such a word once with z = 1 to get a bound-5 witness for 7⁸⁶, so n = 86 is covered too.
Bound 5 for 7ⁿ, odd part ≤ 41, or n = 43 or 86 (Thm. 1, opening)
For every n ≥ 1 whose odd part is at most 41, and for n = 43 and n = 86, 7ⁿ has a numerator a with 0 < a < 7ⁿ, sharing no factor with 7ⁿ, whose canonical partial quotients are all at most 5.
theorem ZarembaPowersOf7.thm1_bound5_powers_of_7_with_n86 (n : ℕ) (hn : 1 ≤ n) (h : oddPart n ≤ 41 ∨ n = 43 ∨ n = 86) : HasZarembaWitness (7 ^ n) 5
Bound 5 for 7 to the power c·2ʲ, odd c ≤ 41
For every odd c ≤ 41 and every j ≥ 0, 7 to the power c·2ʲ has an S1 witness at bound 5, and so a Zaremba witness at bound 5.
Bound 5 for 7⁴³
7⁴³ has a Zaremba witness at bound 5.
Bound 5 for q² when w starts with 5 and ends at most 4
Let w be canonical, of length at least 2, with denominator q ≥ 2, every entry at most 5, leading entry 5 and last entry at most 4. Then q² has a Zaremba witness at bound 5, and the 1-fold of w ends in 5.
40 rows end at most 4, and 7⁸⁶ is at bound 5
Exactly 40 of the 47 rows for 7⁴³ have last entry at most 4, and for each of them 7⁸⁶ has a Zaremba witness at bound 5 and the 1-fold of its word ends in 5.
Bound 5 for 7⁸⁶
7⁸⁶ has a Zaremba witness at bound 5.
Bounds 4, 3 and 2
Eight S1 witnesses at bound 4 and S1 doubling give bound 4 whenever n ≥ 1 and the odd part of n is at most 15. Komatsu's 5/7 and 30/49 and six S2 witnesses at bound 3, with S2 doubling, give bound 3 whenever the odd part is at most 13. A search Lean runs, with a proof that it misses no numerator, lists every bound-2 numerator of 7¹ to 7⁸, and finds none for 7⁷.
Bound 4 for 7ⁿ when the odd part is at most 15 (Proposition 2)
For every n ≥ 1 whose odd part is at most 15, 7ⁿ has a numerator a with 0 < a < 7ⁿ, sharing no factor with 7ⁿ, whose canonical partial quotients are all at most 4.
- The eight rows for bound 4
- The S2 check
- The six rows for bound 3
Bound 3 for 7ⁿ when the odd part is at most 13
For every n ≥ 1 whose odd part is at most 13, 7ⁿ has a Zaremba witness at bound 3.
Bound 2 fails at 7⁷
7⁷ = 823,543 has no Zaremba witness at bound 2.
- The bound-2 search, step by step
- The bound-2 search
The search misses no bound-2 numerator
If 7 divides Q and the search returns a list, then every a with 0 < a < Q, sharing no factor with Q and with K(a/Q) ≤ 2, is in it.
The search for 7⁷ finds nothing
With allowance 36, the search for 823,543 returns the empty list.
- The 20 rows for bound 2
All bound-2 numerators of 7¹ to 7⁸
For each n from 1 to 8, the a with 0 < a < 7ⁿ, sharing no factor with 7ⁿ and with K(a/7ⁿ) ≤ 2, are exactly those the search returned: 1, 4, 4, 1, 5, 1, 0 and 4 of them.