{
  "id": "4547",
  "ident": "NS.04547",
  "slug": "oeis-105720",
  "title": "Triangular matchstick numbers in the class of prime numbers",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Terms are squares at only(?) three values of $n = 3, 6, 4072$:\ncorresponding terms are 6^2, 13^2, and 15735^2.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA105720.conjecture",
  "statement_lean": "theorem conjecture :\n    ∀ n : ℕ, 0 < n → (IsSquare (a n) ↔ (n = 3 ∨ n = 6 ∨ n = 4072))",
  "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# Triangular matchstick numbers in the class of prime numbers\n\n$a(n) = \\sum_{k = n}^{2n} p_k$, where $p_k$ is the $k$-th prime.\n\n*References:*\n- [A105720](https://oeis.org/A105720)\n-/\n\n@[expose] public section\n\nnamespace OeisA105720\n\nopen Nat Finset\n\n/--\nThe primary defining sequence `a`.\n$a(n)$ is the sum of primes from the $n$-th prime to the $2n$-th prime, with $p_1=2$.\nFor $n=0$, we define $a(0) = 0$.\n-/\nnoncomputable def a (n : ℕ) : ℕ :=\n  if n = 0 then 0\n  else ∑ i ∈ Ico (n - 1) (2 * n), Nat.nth Nat.Prime i\n\n@[category API, AMS 11]\nlemma nth_prime_five : Nat.nth Nat.Prime 5 = 13 := by\n  have h1 : Nat.count Nat.Prime 13 = 5 := by decide\n  have h2 : (13).Prime := by decide\n  have h3 := Nat.nth_count h2\n  rwa [h1] at h3\n\n@[category API, AMS 11]\nlemma nth_prime_six : Nat.nth Nat.Prime 6 = 17 := by\n  have h1 : Nat.count Nat.Prime 17 = 6 := by decide\n  have h2 : (17).Prime := by decide\n  have h3 := Nat.nth_count h2\n  rwa [h1] at h3\n\n@[category API, AMS 11]\nlemma nth_prime_seven : Nat.nth Nat.Prime 7 = 19 := by\n  have h1 : Nat.count Nat.Prime 19 = 7 := by decide\n  have h2 : (19).Prime := by decide\n  have h3 := Nat.nth_count h2\n  rwa [h1] at h3\n\nmacro \"eval_a\" : tactic => `(tactic| (\n  repeat rw [Finset.sum_Ico_succ_top (by decide)]\n  simp only [Finset.Ico_self, Finset.sum_empty, zero_add, add_zero]\n  simp only [Nat.nth_prime_zero_eq_two, Nat.nth_prime_one_eq_three,\n    Nat.nth_prime_two_eq_five, Nat.nth_prime_three_eq_seven,\n    Nat.nth_prime_four_eq_eleven, nth_prime_five, nth_prime_six, nth_prime_seven]\n  try rfl\n))\n\n/-- Value of the sequence `a` at 0. -/\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 0 := by\n  rw [a, if_pos rfl]\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 5 := by\n  rw [a, if_neg (by decide)]\n  eval_a\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 15 := by\n  rw [a, if_neg (by decide)]\n  eval_a\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 36 := by\n  rw [a, if_neg (by decide)]\n  eval_a\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 67 := by\n  rw [a, if_neg (by decide)]\n  eval_a\n\n/--\nTerms are squares at only(?) three values of $n = 3, 6, 4072$:\ncorresponding terms are 6^2, 13^2, and 15735^2.\n-/\n@[category research open, AMS 11]\ntheorem conjecture :\n    ∀ n : ℕ, 0 < n → (IsSquare (a n) ↔ (n = 3 ∨ n = 6 ∨ n = 4072)) := by\n  sorry\n\nend OeisA105720\n",
  "statement_hash": "1fcba6f9f476e89cb99b3e9676b98d924dd937df0d2e7ba7b840dcaa8eff74df",
  "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."
}