{
  "id": "6325",
  "ident": "NS.06325",
  "slug": "oeis-363347",
  "title": "Realization of primes $p \\equiv \\pm 1 \\pmod{10}$ by continued fraction denominators",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: The sequence contains all prime numbers which end with a 1 or 9 (i.e., primes $p \\equiv 1$ or $9 \\pmod{10}$).\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": "OeisA363347.exists_a_eq_prime",
  "statement_lean": "theorem exists_a_eq_prime :\n    ∀ p : ℕ, (p.Prime ∧ (p ≡ 1 [MOD 10] ∨ p ≡ 9 [MOD 10])) → ∃ n : ℕ, 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# Realization of primes $p \\equiv \\pm 1 \\pmod{10}$ by continued fraction denominators\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}{-4}}}}}}$$\n\n*References:*\n- [A363347](https://oeis.org/A363347)\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 OeisA363347\n\n\nopen Rat Nat\n\n/--\nHelper function for a, which computes the denominator $R_k(n)$ of the continued fraction expression.\nFor $2 \\le k \\le n-1$, $R_k(n)$ is defined recursively:\n$$R_k(n) = k - \\frac{k+1}{R_{k+1}(n)}$$\nThe base case is $R_{n-1}(n) = (n-1) - \\frac{n}{-4}$.\n-/\ndef continuedFractionDenominator (n k : ℕ) : ℚ :=\n  if n ≤ 2 then 0\n  else\n    -- The recursive descent involves terms from $k=n-1$ down to $k=2$.\n    if 2 ≤ k ∧ k ≤ n - 1 then\n      -- Base Case: k = n - 1.\n      if k = n - 1 then\n        -- R_{n-1} = (n-1) + n/4\n        (k : ℚ) + (n : ℚ) / 4\n      -- Recursive Step: 2 <= k < n - 1.\n      else\n        let R_next := continuedFractionDenominator n (k + 1)\n        -- R_k = k - (k+1) / R_{k+1}\n        (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}{-4}}}}}} $$\nThe value of the continued fraction is $C_n = 1/R_2(n)$.\nIf $R_2(n) = N/D$ in reduced form, $C_n = D/N$.\nThe sequence $a(n)$ is the denominator of the final fraction, which is $\\vert N \\vert$.\n-/\ndef a (n : ℕ) : ℕ :=\n  if n ≤ 2 then 0 -- The sequence is indexed starting from $n=3$.\n  else\n    let R2 := continuedFractionDenominator n 2\n    R2.num.natAbs\n\n\n@[category test, AMS 11]\nlemma a_3 : a 3 = 11 := by delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_4 : a 4 = 5 := by delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_5 : a 5 = 31 := by delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_6 : a 6 = 11 := by delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n@[category test, AMS 11]\nlemma a_7 : a 7 = 59 := by delta a; repeat rw [continuedFractionDenominator]; norm_num\n\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture: The sequence contains all prime numbers which end with a 1 or 9 (i.e., primes $p \\equiv 1$ or $9 \\pmod{10}$).\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 formal_conjectures at\n\"https://github.com/mo271/formal-conjectures/blob/a32396489dcb8f86c3549b93aa358ac6a10a3a1f/FormalConjectures/OEIS/363347.wip.lean#L825\"]\ntheorem exists_a_eq_prime :\n    ∀ p : ℕ, (p.Prime ∧ (p ≡ 1 [MOD 10] ∨ p ≡ 9 [MOD 10])) → ∃ n : ℕ, a n = p := by\n    sorry\n\nend OeisA363347\n",
  "statement_hash": "03fa2d7d49a26fdcac89cd98fce9afb73d7a15bee956136794a491f25c25a5c7",
  "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."
}