{
  "id": "7734",
  "ident": "NS.07734",
  "slug": "wikipedia-chebyshevbias",
  "title": "Chebyshev's bias",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Littlewood's oscillation theorem (1914): both $\\pi(n; 4, 3) > \\pi(n; 4, 1)$ and\n$\\pi(n; 4, 1) > \\pi(n; 4, 3)$ hold for infinitely many $n \\in \\mathbb{N}$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "wikipedia",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "ChebyshevBias.littlewood_mod_four_sign_changes",
  "statement_lean": "theorem littlewood_mod_four_sign_changes :\n    chebyshevModFourLeadSet.Infinite ∧\n      {n : ℕ | n.primeCountingMod 4 3 < n.primeCountingMod 4 1}.Infinite",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Chebyshev's bias\n\nLet $\\pi(n; q, r)$ (`Nat.primeCountingMod n q r`) count primes $p \\le n$ satisfying\n$p \\equiv r \\pmod q$. Pafnuty Chebyshev (1853) noted that $\\pi(n; 4, 3)$ usually exceeds\n$\\pi(n; 4, 1)$. John E. Littlewood (1914) established that $\\pi(n; 4, 3) - \\pi(n; 4, 1)$ switches\nsign infinitely often (first becoming negative at $n = 26861$). Jerzy Kaczorowski (1995) disproved\nStanisław Knapowski and Pál Turán's (1962) conjecture that\n$\\{n \\in \\mathbb{N} : \\pi(n; 4, 3) > \\pi(n; 4, 1)\\}$ has natural density $1$ assuming GRH for\n$L(s, \\chi_4)$, whereas Kevin Ford, Sergei Konyagin, and Youness Lamzouri (2013) showed that\nhypothetical off-critical zeros could force natural density $0$ or $1$. Assuming GRH and linear\nindependence of positive ordinates of Dirichlet $L$-zeros, Michael Rubinstein and Peter Sarnak\n(1994) showed this set has logarithmic density $\\delta_{4; 3, 1} \\approx 0.9959 \\in (1/2, 1)$, and\nmore generally that coprime quadratic nonresidues modulo $q \\ge 3$ lead coprime quadratic residues\nwith logarithmic density in $(1/2, 1)$; proving this unconditionally remains open.\n\n*References:*\n- [Wikipedia](https://en.wikipedia.org/wiki/Chebyshev%27s_bias)\n- J. E. Littlewood, *Sur la distribution des nombres premiers*, C. R. Acad. Sci. **158**\n  (1914), 1869–1872.\n- M. Rubinstein and P. Sarnak, *Chebyshev's bias*, Experiment. Math. **3** (1994), 173–197.\n- J. Kaczorowski, *On the distribution of primes ($\\bmod\\, 4$)*, Analysis **15** (1995), no. 2,\n  159–171.\n- K. Ford, S. Konyagin, and Y. Lamzouri, *The prime number race and zeros of Dirichlet\n  $L$-functions off the critical line. III*, Quart. J. Math. **64** (2013), no. 4, 1091–1098\n  (`arXiv:1204.6715`).\n-/\n\n@[expose] public section\n\nnamespace ChebyshevBias\n\n/-- Integers $n \\in \\mathbb{N}$ where $\\pi(n; 4, 3) > \\pi(n; 4, 1)$. -/\ndef chebyshevModFourLeadSet : Set ℕ :=\n  {n : ℕ | n.primeCountingMod 4 1 < n.primeCountingMod 4 3}\n\n/-- At $n = 10$, $\\pi(10; 4, 3) = 2$ exceeds $\\pi(10; 4, 1) = 1$, so `10` belongs to\n`chebyshevModFourLeadSet`. -/\n@[category test, AMS 11]\ntheorem ten_mem_chebyshevModFourLeadSet : 10 ∈ chebyshevModFourLeadSet := by\n  change Nat.primeCountingMod 10 4 1 < Nat.primeCountingMod 10 4 3\n  decide\n\n/-- At $n = 5$, $\\pi(5; 4, 3) = 1$ equals $\\pi(5; 4, 1) = 1$, so `5` does not belong to\n`chebyshevModFourLeadSet`. -/\n@[category test, AMS 11]\ntheorem five_notMem_chebyshevModFourLeadSet : 5 ∉ chebyshevModFourLeadSet := by\n  change ¬ (Nat.primeCountingMod 5 4 1 < Nat.primeCountingMod 5 4 3)\n  decide\n\n/-- Littlewood's oscillation theorem (1914): both $\\pi(n; 4, 3) > \\pi(n; 4, 1)$ and\n$\\pi(n; 4, 1) > \\pi(n; 4, 3)$ hold for infinitely many $n \\in \\mathbb{N}$. -/\n@[category research solved, AMS 11]\ntheorem littlewood_mod_four_sign_changes :\n    chebyshevModFourLeadSet.Infinite ∧\n      {n : ℕ | n.primeCountingMod 4 3 < n.primeCountingMod 4 1}.Infinite := by\n  sorry\n\n/-- Conditional refutation of the Knapowski–Turán natural-density conjecture (Kaczorowski 1995):\nassuming the Generalized Riemann Hypothesis for $L(s, \\chi_4)$, the set of $n \\in \\mathbb{N}$ with\n$\\pi(n; 4, 3) > \\pi(n; 4, 1)$ does not have natural density $1$. (Ford, Konyagin, and Lamzouri,\n`arXiv:1204.6715`, showed that hypothetical off-critical zeros could make the natural density $0$\nor $1$.) -/\n@[category research solved, AMS 11]\ntheorem knapowski_turan_natural_density_false\n    (hGRH : ∀ s : ℂ, 0 < s.re → s.re < 1 →\n      DirichletCharacter.LFunction (ZMod.χ₄.ringHomComp (Int.castRingHom ℂ)) s = 0 →\n      s.re = 1 / 2) :\n    ¬ chebyshevModFourLeadSet.HasDensity 1 := by\n  sorry\n\n/-- Unconditional Rubinstein–Sarnak Chebyshev bias conjecture modulo $4$ (obtained by removing GRH\nand the linear independence hypothesis LI from Rubinstein and Sarnak's conditional theorem): the\nset of $n \\in \\mathbb{N}$ satisfying $\\pi(n; 4, 3) > \\pi(n; 4, 1)$ admits a logarithmic density\n$\\delta \\in (1/2, 1)$. -/\n@[category research open, AMS 11]\ntheorem rubinstein_sarnak_unconditional_chebyshev_bias :\n    ∃ δ : ℝ, (1 : ℝ) / 2 < δ ∧ δ < 1 ∧ Set.HasLogDensity chebyshevModFourLeadSet δ := by\n  sorry\n\n/-- Unconditional general-modulus Chebyshev bias conjecture (obtained by removing GRH and the\nlinear independence hypothesis LI from Rubinstein and Sarnak's conditional theorem): for any\nmodulus $q \\ge 3$ and integers $a, b$ coprime to $q$ such that $a$ is a quadratic residue modulo\n$q$ and $b$ is a quadratic nonresidue modulo $q$, the set\n$\\{n \\in \\mathbb{N} : \\pi(n; q, b) > \\pi(n; q, a)\\}$ admits a logarithmic density\n$\\delta \\in (1/2, 1)$. -/\n@[category research open, AMS 11]\ntheorem rubinstein_sarnak_unconditional_chebyshev_bias.variants.general_modulus\n    (q a b : ℕ) (hq : 3 ≤ q) (ha : a.Coprime q) (hb : b.Coprime q)\n    (hres : IsSquare (a : ZMod q)) (hnonres : ¬ IsSquare (b : ZMod q)) :\n    ∃ δ : ℝ, (1 : ℝ) / 2 < δ ∧ δ < 1 ∧\n      Set.HasLogDensity {n : ℕ | n.primeCountingMod q a < n.primeCountingMod q b} δ := by\n  sorry\n\nend ChebyshevBias\n",
  "statement_hash": "2d34c2d0bcf01e146f811107ece5dceedf94325834c308e148d6d935d7e4f17b",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}