{
  "id": "5333",
  "ident": "NS.05333",
  "slug": "oeis-217317",
  "title": "Number of primes between $n^2$ and $n^2 + (\\log_2 n)^2$",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: For every $n > 4765516$, $a(n) > 0$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA217317.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) (hn : 4765516 < n) : 0 < a n",
  "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# Number of primes between $n^2$ and $n^2 + (\\log_2 n)^2$\n\nFor $n \\ge 1$, $a(n)$ is the number of primes between $n^2$ and $n^2 + (\\log_2 n)^2$ inclusive,\ngiven by $\\pi(\\lfloor n^2 + (\\log_2 n)^2 \\rfloor) - \\pi(n^2)$.\n\n*References:*\n- [A217317](https://oeis.org/A217317)\n-/\n\n@[expose] public section\n\nnamespace OeisA217317\n\n/-- Number of primes between $n^2$ and $n^2 + (\\log_2 n)^2$ inclusive. -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  if n = 0 then 0\n  else\n    let upperBound : ℕ := Int.toNat ⌊(n : ℝ) ^ 2 + (Real.logb 2 n) ^ 2⌋\n    Nat.primeCounting upperBound - Nat.primeCounting (n ^ 2)\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by\n  simp [a]\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by\n  have h : Real.logb 2 2 = 1 := Real.logb_self_eq_one (by norm_num)\n  have h2 : Int.toNat ⌊(2 : ℝ) ^ 2 + (1 : ℝ) ^ 2⌋ = 5 := by norm_num; rfl\n  unfold a\n  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]\n  decide\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 2 := by\n  have h : Real.logb 2 4 = 2 := by\n    rw [show (4 : ℝ) = 2 ^ (2 : ℕ) by norm_num, Real.logb_pow,\n      Real.logb_self_eq_one (by norm_num)]\n    norm_num\n  have h2 : Int.toNat ⌊(4 : ℝ) ^ 2 + (2 : ℝ) ^ 2⌋ = 20 := by norm_num; rfl\n  unfold a\n  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]\n  decide\n\n@[category test, AMS 11]\ntheorem a_8 : a 8 = 3 := by\n  have h : Real.logb 2 8 = 3 := by\n    rw [show (8 : ℝ) = 2 ^ (3 : ℕ) by norm_num, Real.logb_pow,\n      Real.logb_self_eq_one (by norm_num)]\n    norm_num\n  have h2 : Int.toNat ⌊(8 : ℝ) ^ 2 + (3 : ℝ) ^ 2⌋ = 73 := by norm_num; rfl\n  unfold a\n  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]\n  decide\n\n@[category test, AMS 11]\ntheorem a_16 : a 16 = 4 := by\n  have h : Real.logb 2 16 = 4 := by\n    rw [show (16 : ℝ) = 2 ^ (4 : ℕ) by norm_num, Real.logb_pow,\n      Real.logb_self_eq_one (by norm_num)]\n    norm_num\n  have h2 : Int.toNat ⌊(16 : ℝ) ^ 2 + (4 : ℝ) ^ 2⌋ = 272 := by norm_num; rfl\n  have hp : ∀ {k : ℕ}, (k + 1).Prime →\n      Nat.primeCounting (k + 1) = Nat.primeCounting k + 1 := fun {k} hk => by\n    rw [← Nat.primesLE_card_eq_primeCounting, ← Nat.primesLE_card_eq_primeCounting,\n      Nat.primesLE_succ, if_pos hk, Finset.card_insert_of_notMem (Nat.notMem_primesLE k)]\n  have hn : ∀ {k : ℕ}, ¬ (k + 1).Prime →\n      Nat.primeCounting (k + 1) = Nat.primeCounting k := fun {k} hk => by\n    rw [← Nat.primesLE_card_eq_primeCounting, ← Nat.primesLE_card_eq_primeCounting,\n      Nat.primesLE_succ, if_neg hk]\n  unfold a\n  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]\n  rw [show (16 ^ 2 : ℕ) = 256 by norm_num, show (272 : ℕ) = 271 + 1 from rfl]\n  rw [hn (by norm_num : ¬ (271 + 1).Prime)]\n  rw [show (271 : ℕ) = 270 + 1 from rfl, hp (by norm_num)]\n  rw [show (270 : ℕ) = 269 + 1 from rfl, hn (by norm_num)]\n  rw [show (269 : ℕ) = 268 + 1 from rfl, hp (by norm_num)]\n  rw [show (268 : ℕ) = 267 + 1 from rfl, hn (by norm_num)]\n  rw [show (267 : ℕ) = 266 + 1 from rfl, hn (by norm_num)]\n  rw [show (266 : ℕ) = 265 + 1 from rfl, hn (by norm_num)]\n  rw [show (265 : ℕ) = 264 + 1 from rfl, hn (by norm_num)]\n  rw [show (264 : ℕ) = 263 + 1 from rfl, hn (by norm_num)]\n  rw [show (263 : ℕ) = 262 + 1 from rfl, hp (by norm_num)]\n  rw [show (262 : ℕ) = 261 + 1 from rfl, hn (by norm_num)]\n  rw [show (261 : ℕ) = 260 + 1 from rfl, hn (by norm_num)]\n  rw [show (260 : ℕ) = 259 + 1 from rfl, hn (by norm_num)]\n  rw [show (259 : ℕ) = 258 + 1 from rfl, hn (by norm_num)]\n  rw [show (258 : ℕ) = 257 + 1 from rfl, hn (by norm_num)]\n  rw [show (257 : ℕ) = 256 + 1 from rfl, hp (by norm_num)]\n  omega\n\n/--\nConjecture: For every $n > 4765516$, $a(n) > 0$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture (n : ℕ) (hn : 4765516 < n) : 0 < a n := by\n  sorry\n\nend OeisA217317\n",
  "statement_hash": "8cdc38d2d05d0063d750deee8edf2115e023daeceeea18514f25d0897c979e15",
  "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."
}