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 in nn-th row of triangle k2−k+pnk^2 - k + p_n

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: a(n)<na(n) < n for n>13n > 13.

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

Formal statement

theorem conjecture (n : ℕ) (h : n > 13) : a n < n
Show the full Challenge.lean (131 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Number of primes in $n$-th row of triangle $k^2 - k + p_n$

$a(n)$ is the number of primes in the $n$-th row of the triangle $T(n, k) = k^2 - k + p_n$
for $1 \le k \le n$, where $p_n$ is the $n$-th prime ($p_1=2, p_2=3, \dots$).

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

@[expose] public section

namespace OeisA117531

/-- Number of primes in the $n$-th row of $T(n, k) = k^2 - k + p_n$ for $1 \le k \le n$. -/
noncomputable def a (n : ℕ) : ℕ :=
  let pn : ℕ := Nat.nth Nat.Prime (n - 1)
  Finset.card ((Finset.Icc 1 n).filter fun k => (k ^ 2 - k + pn).Prime)

/-- Value of the sequence `a` at 0. -/
@[category test, AMS 11]
theorem a_0 : a 0 = 0 := by rfl

/-- Value of the sequence `a` at 1. -/
@[category test, AMS 11]
theorem a_1 : a 1 = 1 := by
  unfold a
  have h_zero : Nat.nth Nat.Prime (1 - 1) = 2 := Nat.nth_prime_zero_eq_two
  dsimp only
  rw [h_zero]
  have h1 : Finset.Icc 1 1 = {1} := by decide
  rw [h1]
  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 2).Prime) {1}) = {1} := by
    ext x
    simp only [Finset.mem_filter, Finset.mem_singleton]
    constructor
    · intro h; exact h.1
    · rintro rfl; exact ⟨rfl, by norm_num⟩
  rw [this, Finset.card_singleton]

/-- Value of the sequence `a` at 2. -/
@[category test, AMS 11]
theorem a_2 : a 2 = 2 := by
  unfold a
  have h_one : Nat.nth Nat.Prime (2 - 1) = 3 := Nat.nth_prime_one_eq_three
  dsimp only
  rw [h_one]
  have h2 : Finset.Icc 1 2 = {1, 2} := by decide
  rw [h2]
  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 3).Prime) {1, 2}) = {1, 2} := by
    ext x
    simp only [Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton]
    constructor
    · intro h; exact h.1
    · rintro (rfl | rfl)
      · refine ⟨Or.inl rfl, by norm_num⟩
      · refine ⟨Or.inr rfl, by norm_num⟩
  rw [this, Finset.card_pair (by decide)]

/-- Value of the sequence `a` at 3. -/
@[category test, AMS 11]
theorem a_3 : a 3 = 3 := by
  unfold a
  have h_two : Nat.nth Nat.Prime (3 - 1) = 5 := Nat.nth_prime_two_eq_five
  dsimp only
  rw [h_two]
  have h3 : Finset.Icc 1 3 = {1, 2, 3} := by decide
  rw [h3]
  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 5).Prime) {1, 2, 3}) = {1, 2, 3} := by
    ext x
    simp only [Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton]
    constructor
    · intro h; exact h.1
    · rintro (rfl | rfl | rfl)
      · refine ⟨Or.inl rfl, by norm_num⟩
      · refine ⟨Or.inr (Or.inl rfl), by norm_num⟩
      · refine ⟨Or.inr (Or.inr rfl), by norm_num⟩
  rw [this]
  decide

/-- Value of the sequence `a` at 4. -/
@[category test, AMS 11]
theorem a_4 : a 4 = 3 := by
  unfold a
  have h_three : Nat.nth Nat.Prime (4 - 1) = 7 := Nat.nth_prime_three_eq_seven
  dsimp only
  rw [h_three]
  have h4 : Finset.Icc 1 4 = {1, 2, 3, 4} := by decide
  rw [h4]
  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 7).Prime) {1, 2, 3, 4}) = {1, 3, 4} := by
    ext x
    simp only [Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton]
    constructor
    · rintro ⟨(rfl | rfl | rfl | rfl), hp⟩
      · exact Or.inl rfl
      · exfalso; revert hp; norm_num
      · exact Or.inr (Or.inl rfl)
      · exact Or.inr (Or.inr rfl)
    · rintro (rfl | rfl | rfl)
      · refine ⟨Or.inl rfl, by norm_num⟩
      · refine ⟨Or.inr (Or.inr (Or.inl rfl)), by norm_num⟩
      · refine ⟨Or.inr (Or.inr (Or.inr rfl)), by norm_num⟩
  rw [this]
  decide

/--
Conjecture: $a(n) < n$ for $n > 13$.-/
@[category research open, AMS 11]
theorem conjecture (n : ℕ) (h : n > 13) : a n < n := by
  sorry

end OeisA117531

To prove it: keep every definition of Challenge.lean unchanged and prove OeisA117531.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-117531
nosorry submit oeis-117531 nosorry/oeis-117531/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.