{
  "id": "6400",
  "ident": "NS.06400",
  "slug": "oeis-372761",
  "title": "Unique realization of odd primes $p \\notin \\{3, 5\\}$ by continued fraction values",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: Except for 3 and 5, all odd primes appear in the sequence once. - _Thomas Scheuerle_, May 11 2024\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA372761.exists_unique_a_eq_prime",
  "statement_lean": "theorem exists_unique_a_eq_prime :\n    ∀ p : ℕ, Nat.Prime p ∧ p % 2 = 1 ∧ p ≠ 3 ∧ p ≠ 5 → ∃! n, n ≥ 3 ∧ a n = p",
  "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# Unique realization of odd primes $p \\notin \\{3, 5\\}$ by continued fraction values\n\n$a(n)$ is the denominator of the finite continued fraction\n$$\\frac{1}{2 - \\frac{3}{3 - \\frac{4}{4 - \\frac{5}{\\dots - \\frac{n-1}{(n-1) - \\frac{n}{n+4}}}}}}$$\n\n*References:*\n- [A372761](https://oeis.org/A372761)\n- [arxiv/2605.22763](https://arxiv.org/abs/2605.22763) *Advancing Mathematics Research with AI-Driven Formal Proof Search* by George Tsoukalas et al.\n-/\n\n@[expose] public section\n\nnamespace OeisA372761\n\n\nopen scoped Nat\n\nopen Rat\n\n/--\nRecursive helper computing the continued fraction denominator $R_k(n)$ for $2 \\le k \\le n-1$,\nwhere $R_k(n) = k - \\frac{k+1}{R_{k+1}(n)}$ with base case $R_{n-1}(n) = (n-1) - \\frac{n}{n+4}$.\n-/\ndef continuedFractionDenominator (n k : ℕ) : ℚ :=\n  if n ≤ 2 then 0\n  else\n    if 2 ≤ k ∧ k ≤ n - 1 then\n      if k = n - 1 then\n        (k : ℚ) - (n : ℚ) / (n + 4 : ℚ)\n      else\n        let R_next := continuedFractionDenominator n (k + 1)\n        if R_next = 0 then 0 else (k : ℚ) - (k + 1 : ℚ) / R_next\n    else 0\ntermination_by n - k\n\n/--\nDenominator of the continued fraction\n$$ \\frac{1}{2 - \\frac{3}{3 - \\frac{4}{4 - \\frac{5}{\\dots - \\frac{n-1}{(n-1) - \\frac{n}{n+4}}}}}} $$\n-/\ndef a (n : ℕ) : ℕ :=\n  if n < 3 then 0 -- Sequence starts at n=3.\n  else (1 / continuedFractionDenominator n 2).den\n\n\n@[category test, AMS 11]\nlemma a_3 : a 3 = 11 := by\n  delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_4 : a 4 = 4 := by\n  delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_5 : a 5 = 7 := by\n  delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_6 : a 6 = 13 := by\n  delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_7 : a 7 = 31 := by\n  delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture: Except for 3 and 5, all odd primes appear in the sequence once. - _Thomas Scheuerle_, May 11 2024\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at\n\"https://github.com/mo271/formal-conjectures/blob/a32396489dcb8f86c3549b93aa358ac6a10a3a1f/FormalConjectures/OEIS/372761.wip.lean#L733\"]\ntheorem exists_unique_a_eq_prime :\n    ∀ p : ℕ, Nat.Prime p ∧ p % 2 = 1 ∧ p ≠ 3 ∧ p ≠ 5 → ∃! n, n ≥ 3 ∧ a n = p := by\n    sorry\n\nend OeisA372761\n",
  "statement_hash": "2b3f2224973e33d2bf005f8cf57ba79fb57a954315ada7749de3051ea8696420",
  "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."
}