{
  "id": "4876",
  "ident": "NS.04876",
  "slug": "oeis-117531",
  "title": "Number of primes in $n$-th row of triangle $k^2 - k + p_n$",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: $a(n) < n$ for $n > 13$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA117531.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) (h : n > 13) : a n < 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 in $n$-th row of triangle $k^2 - k + p_n$\n\n$a(n)$ is the number of primes in the $n$-th row of the triangle $T(n, k) = k^2 - k + p_n$\nfor $1 \\le k \\le n$, where $p_n$ is the $n$-th prime ($p_1=2, p_2=3, \\dots$).\n\n*References:*\n- [A117531](https://oeis.org/A117531)-/\n\n@[expose] public section\n\nnamespace OeisA117531\n\n/-- Number of primes in the $n$-th row of $T(n, k) = k^2 - k + p_n$ for $1 \\le k \\le n$. -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  let pn : ℕ := Nat.nth Nat.Prime (n - 1)\n  Finset.card ((Finset.Icc 1 n).filter fun k => (k ^ 2 - k + pn).Prime)\n\n/-- Value of the sequence `a` at 0. -/\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 0 := by rfl\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 1 := by\n  unfold a\n  have h_zero : Nat.nth Nat.Prime (1 - 1) = 2 := Nat.nth_prime_zero_eq_two\n  dsimp only\n  rw [h_zero]\n  have h1 : Finset.Icc 1 1 = {1} := by decide\n  rw [h1]\n  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 2).Prime) {1}) = {1} := by\n    ext x\n    simp only [Finset.mem_filter, Finset.mem_singleton]\n    constructor\n    · intro h; exact h.1\n    · rintro rfl; exact ⟨rfl, by norm_num⟩\n  rw [this, Finset.card_singleton]\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 2 := by\n  unfold a\n  have h_one : Nat.nth Nat.Prime (2 - 1) = 3 := Nat.nth_prime_one_eq_three\n  dsimp only\n  rw [h_one]\n  have h2 : Finset.Icc 1 2 = {1, 2} := by decide\n  rw [h2]\n  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 3).Prime) {1, 2}) = {1, 2} := by\n    ext x\n    simp only [Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton]\n    constructor\n    · intro h; exact h.1\n    · rintro (rfl | rfl)\n      · refine ⟨Or.inl rfl, by norm_num⟩\n      · refine ⟨Or.inr rfl, by norm_num⟩\n  rw [this, Finset.card_pair (by decide)]\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 3 := by\n  unfold a\n  have h_two : Nat.nth Nat.Prime (3 - 1) = 5 := Nat.nth_prime_two_eq_five\n  dsimp only\n  rw [h_two]\n  have h3 : Finset.Icc 1 3 = {1, 2, 3} := by decide\n  rw [h3]\n  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 5).Prime) {1, 2, 3}) = {1, 2, 3} := by\n    ext x\n    simp only [Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton]\n    constructor\n    · intro h; exact h.1\n    · rintro (rfl | rfl | rfl)\n      · refine ⟨Or.inl rfl, by norm_num⟩\n      · refine ⟨Or.inr (Or.inl rfl), by norm_num⟩\n      · refine ⟨Or.inr (Or.inr rfl), by norm_num⟩\n  rw [this]\n  decide\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 3 := by\n  unfold a\n  have h_three : Nat.nth Nat.Prime (4 - 1) = 7 := Nat.nth_prime_three_eq_seven\n  dsimp only\n  rw [h_three]\n  have h4 : Finset.Icc 1 4 = {1, 2, 3, 4} := by decide\n  rw [h4]\n  have : (Finset.filter (fun k : ℕ => (k ^ 2 - k + 7).Prime) {1, 2, 3, 4}) = {1, 3, 4} := by\n    ext x\n    simp only [Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton]\n    constructor\n    · rintro ⟨(rfl | rfl | rfl | rfl), hp⟩\n      · exact Or.inl rfl\n      · exfalso; revert hp; norm_num\n      · exact Or.inr (Or.inl rfl)\n      · exact Or.inr (Or.inr rfl)\n    · rintro (rfl | rfl | rfl)\n      · refine ⟨Or.inl rfl, by norm_num⟩\n      · refine ⟨Or.inr (Or.inr (Or.inl rfl)), by norm_num⟩\n      · refine ⟨Or.inr (Or.inr (Or.inr rfl)), by norm_num⟩\n  rw [this]\n  decide\n\n/--\nConjecture: $a(n) < n$ for $n > 13$.-/\n@[category research open, AMS 11]\ntheorem conjecture (n : ℕ) (h : n > 13) : a n < n := by\n  sorry\n\nend OeisA117531\n",
  "statement_hash": "7ac7567d992df3be773cab2a3cb2e7665621c037ce948f82c088c67b9df51c5c",
  "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."
}