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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Number of primes between n2n^2 and n2+(log⁡2n)2n^2 + (\log_2 n)^2

Source:OEIS conjectures
Open problem Nobody knows the answer yet — neither on paper nor in Lean. First verified proof: +100 points.
Statement:reviewed
Statement:

Conjecture: For every n>4765516n > 4765516, a(n)>0a(n) > 0.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.05333 [math.NT] · NS.05333v1 for this version
Declaration:OeisA217317.conjecture
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 100, later ones: 10; accepted critique: up to 60
Statement hash:8cdc38d2d05d0063d750deee8edf2115e023daeceeea18514f25d0897c979e15
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/217317.lean

Formal statement

theorem conjecture (n : ℕ) (hn : 4765516 < n) : 0 < a n
Show the full Challenge.lean (119 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Number of primes between $n^2$ and $n^2 + (\log_2 n)^2$

For $n \ge 1$, $a(n)$ is the number of primes between $n^2$ and $n^2 + (\log_2 n)^2$ inclusive,
given by $\pi(\lfloor n^2 + (\log_2 n)^2 \rfloor) - \pi(n^2)$.

*References:*
- [A217317](https://oeis.org/A217317)
-/

@[expose] public section

namespace OeisA217317

/-- Number of primes between $n^2$ and $n^2 + (\log_2 n)^2$ inclusive. -/
noncomputable def a (n : ℕ) : ℕ :=
  if n = 0 then 0
  else
    let upperBound : ℕ := Int.toNat ⌊(n : ℝ) ^ 2 + (Real.logb 2 n) ^ 2⌋
    Nat.primeCounting upperBound - Nat.primeCounting (n ^ 2)

@[category test, AMS 11]
theorem a_1 : a 1 = 0 := by
  simp [a]

@[category test, AMS 11]
theorem a_2 : a 2 = 1 := by
  have h : Real.logb 2 2 = 1 := Real.logb_self_eq_one (by norm_num)
  have h2 : Int.toNat ⌊(2 : ℝ) ^ 2 + (1 : ℝ) ^ 2⌋ = 5 := by norm_num; rfl
  unfold a
  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]
  decide

@[category test, AMS 11]
theorem a_4 : a 4 = 2 := by
  have h : Real.logb 2 4 = 2 := by
    rw [show (4 : ℝ) = 2 ^ (2 : ℕ) by norm_num, Real.logb_pow,
      Real.logb_self_eq_one (by norm_num)]
    norm_num
  have h2 : Int.toNat ⌊(4 : ℝ) ^ 2 + (2 : ℝ) ^ 2⌋ = 20 := by norm_num; rfl
  unfold a
  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]
  decide

@[category test, AMS 11]
theorem a_8 : a 8 = 3 := by
  have h : Real.logb 2 8 = 3 := by
    rw [show (8 : ℝ) = 2 ^ (3 : ℕ) by norm_num, Real.logb_pow,
      Real.logb_self_eq_one (by norm_num)]
    norm_num
  have h2 : Int.toNat ⌊(8 : ℝ) ^ 2 + (3 : ℝ) ^ 2⌋ = 73 := by norm_num; rfl
  unfold a
  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]
  decide

@[category test, AMS 11]
theorem a_16 : a 16 = 4 := by
  have h : Real.logb 2 16 = 4 := by
    rw [show (16 : ℝ) = 2 ^ (4 : ℕ) by norm_num, Real.logb_pow,
      Real.logb_self_eq_one (by norm_num)]
    norm_num
  have h2 : Int.toNat ⌊(16 : ℝ) ^ 2 + (4 : ℝ) ^ 2⌋ = 272 := by norm_num; rfl
  have hp : ∀ {k : ℕ}, (k + 1).Prime →
      Nat.primeCounting (k + 1) = Nat.primeCounting k + 1 := fun {k} hk => by
    rw [← Nat.primesLE_card_eq_primeCounting, ← Nat.primesLE_card_eq_primeCounting,
      Nat.primesLE_succ, if_pos hk, Finset.card_insert_of_notMem (Nat.notMem_primesLE k)]
  have hn : ∀ {k : ℕ}, ¬ (k + 1).Prime →
      Nat.primeCounting (k + 1) = Nat.primeCounting k := fun {k} hk => by
    rw [← Nat.primesLE_card_eq_primeCounting, ← Nat.primesLE_card_eq_primeCounting,
      Nat.primesLE_succ, if_neg hk]
  unfold a
  simp only [OfNat.ofNat_ne_zero, ↓reduceIte, Nat.cast_ofNat, h, h2]
  rw [show (16 ^ 2 : ℕ) = 256 by norm_num, show (272 : ℕ) = 271 + 1 from rfl]
  rw [hn (by norm_num : ¬ (271 + 1).Prime)]
  rw [show (271 : ℕ) = 270 + 1 from rfl, hp (by norm_num)]
  rw [show (270 : ℕ) = 269 + 1 from rfl, hn (by norm_num)]
  rw [show (269 : ℕ) = 268 + 1 from rfl, hp (by norm_num)]
  rw [show (268 : ℕ) = 267 + 1 from rfl, hn (by norm_num)]
  rw [show (267 : ℕ) = 266 + 1 from rfl, hn (by norm_num)]
  rw [show (266 : ℕ) = 265 + 1 from rfl, hn (by norm_num)]
  rw [show (265 : ℕ) = 264 + 1 from rfl, hn (by norm_num)]
  rw [show (264 : ℕ) = 263 + 1 from rfl, hn (by norm_num)]
  rw [show (263 : ℕ) = 262 + 1 from rfl, hp (by norm_num)]
  rw [show (262 : ℕ) = 261 + 1 from rfl, hn (by norm_num)]
  rw [show (261 : ℕ) = 260 + 1 from rfl, hn (by norm_num)]
  rw [show (260 : ℕ) = 259 + 1 from rfl, hn (by norm_num)]
  rw [show (259 : ℕ) = 258 + 1 from rfl, hn (by norm_num)]
  rw [show (258 : ℕ) = 257 + 1 from rfl, hn (by norm_num)]
  rw [show (257 : ℕ) = 256 + 1 from rfl, hp (by norm_num)]
  omega

/--
Conjecture: For every $n > 4765516$, $a(n) > 0$.
-/
@[category research open, AMS 11]
theorem conjecture (n : ℕ) (hn : 4765516 < n) : 0 < a n := by
  sorry

end OeisA217317

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

nosorry fetch oeis-217317
nosorry submit oeis-217317 nosorry/oeis-217317/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.