Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Rudin's conjecture on squares in arithmetic progressions · Q_zero

Source:Wikipedia lists of open problems
Sanity test Checks that the formal definitions behave as intended. First verified proof: +1 points.
Statement:reviewed
Statement:

Sanity check: there are no squares among the first 0 terms of any progression.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.08409 [math.NT] · NS.08409v1 for this version
Declaration:RudinsConjecture.Q_zero
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 1; accepted critique: up to 100
Statement hash:08b044e68fcfa73d98b311fd2d4dbc8a48d51bd2fb582c421aca1b915fd5c19b
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/Wikipedia/RudinsConjecture.lean

Formal statement

theorem Q_zero (q a : ℕ) : Q 0 q a = 0
Show the full Challenge.lean (124 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Rudin's conjecture on squares in arithmetic progressions


*References:*
- [Wikipedia](https://en.wikipedia.org/wiki/Rudin%27s_conjecture)
- [Ru60] Rudin, W., *Trigonometric series with gaps*, J. Math. Mech. 9 (1960), 203–227.
- González-Jiménez, E. and Xarles, X., *On a conjecture of Rudin on squares in arithmetic
  progressions*, LMS J. Comput. Math. 17 (2014), 58–76.
-/

@[expose] public section

open Filter Asymptotics Real

namespace RudinsConjecture

/-- $Q(N; q, a)$ is the number of perfect squares among the first $N$ terms of the arithmetic
progression $\{q n + a : 0 \le n < N\}$. -/
noncomputable abbrev Q (N q a : ℕ) : ℕ := {n : ℕ | n < N ∧ IsSquare (q * n + a)}.ncard

/-- A pair $(q, a)$ describes a *non-trivial* arithmetic progression if $q, a \ge 1$,
$\gcd(q, a) = 1$, and $(q, a) \neq (1, 1)$. -/
def IsNontrivial (q a : ℕ) : Prop :=
  1 ≤ q ∧ 1 ≤ a ∧ Nat.Coprime q a ∧ (q, a) ≠ (1, 1)

/-- $Q(N) = \max Q(N; q, a)$, the largest number of perfect squares occurring among the first
$N$ terms of any non-trivial arithmetic progression. The supremum is over a set of naturals that
is bounded above by $N$ (each progression has only $N$ terms), so it is attained. -/
noncomputable def Qmax (N : ℕ) : ℕ :=
  sSup {m : ℕ | ∃ q a : ℕ, IsNontrivial q a ∧ Q N q a = m}

/-- Sanity check: the progression $24 n + 1$ is non-trivial. -/
@[category test, AMS 11]
theorem isNontrivial_24_1 : IsNontrivial 24 1 := by
  refine ⟨by norm_num, by norm_num, by decide, by decide⟩

/-- Sanity check: there are no squares among the first `0` terms of any progression. -/
@[category test, AMS 11]
theorem Q_zero (q a : ℕ) : Q 0 q a = 0 := by
  simp [Q]

/-- Sanity check pinning `Q` to a concrete value: among the first `6` terms of `24 n + 1`, namely
`1, 25, 49, 73, 97, 121`, exactly four are perfect squares (`1, 25, 49, 121`), so
`Q 6 24 1 = 4`. This validates the definition of `Q` and matches the claim that `24 n + 1` is the
extremal progression. -/
@[category test, AMS 11]
theorem Q_six_twentyfour_one : Q 6 24 1 = 4 := by
  show ({n : ℕ | n < 6 ∧ IsSquare (24 * n + 1)}).ncard = 4
  have hset : {n : ℕ | n < 6 ∧ IsSquare (24 * n + 1)} = ({0, 1, 2, 5} : Set ℕ) := by
    ext n
    simp only [Set.mem_ofPred_eq, Set.mem_insert_iff, Set.mem_singleton_iff]
    constructor
    · rintro ⟨hn, hsq⟩
      interval_cases n
      · omega
      · omega
      · omega
      · exfalso; obtain ⟨r, hr⟩ := hsq
        have hb : r < 9 := by nlinarith
        interval_cases r <;> omega
      · exfalso; obtain ⟨r, hr⟩ := hsq
        have hb : r < 10 := by nlinarith
        interval_cases r <;> omega
      · omega
    · rintro (rfl | rfl | rfl | rfl)
      · exact ⟨by norm_num, 1, by norm_num⟩
      · exact ⟨by norm_num, 5, by norm_num⟩
      · exact ⟨by norm_num, 7, by norm_num⟩
      · exact ⟨by norm_num, 11, by norm_num⟩
  rw [hset]
  have hcoe : ({0, 1, 2, 5} : Set ℕ) = ↑({0, 1, 2, 5} : Finset ℕ) := by simp
  rw [hcoe, Set.ncard_coe_finset]
  decide

/--
**Rudin's conjecture.** The maximal number of squares among the first $N$ terms of a non-trivial
arithmetic progression grows at most like $\sqrt{N}$:
$$Q(N) = O(\sqrt{N}).$$
-/
@[category research open, AMS 11]
theorem rudins_conjecture :
    (fun N : ℕ => (Qmax N : ℝ)) =O[atTop] fun N : ℕ => Real.sqrt N := by
  sorry

/--
A stronger form of Rudin's conjecture: for every $N \ge 6$, the arithmetic progression
$24 n + 1$ attains the maximum $Q(N)$.
-/
@[category research open, AMS 11]
theorem rudins_conjecture_strong (N : ℕ) (hN : 6 ≤ N) : Q N 24 1 = Qmax N := by
  sorry

/--
The strongest form of Rudin's conjecture also asserts *uniqueness*: for $N \ge 6$, any non-trivial
arithmetic progression attaining the maximum $Q(N)$ has common difference $24$. (Its initial term
is then forced by $\gcd(24, a) = 1$; the progression $24n + 1$ is the canonical representative.)
-/
@[category research open, AMS 11]
theorem rudins_conjecture_unique (N : ℕ) (hN : 6 ≤ N) (q a : ℕ)
    (hqa : IsNontrivial q a) (hmax : Q N q a = Qmax N) : q = 24 := by
  sorry

end RudinsConjecture

To prove it: keep every definition of Challenge.lean unchanged and prove RudinsConjecture.Q_zero with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_Q_zero : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry desk wikipedia-rudinsconjecture--q-zero      # a desk lease: required before submitting (renew: nosorry beat)
nosorry fetch wikipedia-rudinsconjecture--q-zero
nosorry submit wikipedia-rudinsconjecture--q-zero nosorry/wikipedia-rudinsconjecture--q-zero/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.