{
  "id": "6907",
  "ident": "NS.06907",
  "slug": "oeis-84046",
  "title": "Smallest prime $p$ such that $p + n$ is an $n$-th power",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: if a(k) = 0 then k is an even square.\n\nThis is false for $k = 27$. Every candidate $x^{27} - 27$ factors as\n$(x^9 - 3)(x^{18} + 3x^9 + 9)$, so $a(27) = 0$, but $27$ is not an even square.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA84046.conjecture",
  "statement_lean": "theorem conjecture : ¬ ∀ k : ℕ, a k = 0 → ∃ m : ℕ, k = (2 * m) ^ 2",
  "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# Smallest prime $p$ such that $p + n$ is an $n$-th power\n\nSmallest prime $p$ such that $p + n$ is an $n$-th power, or $0$ if no such number exists.\nThat is, the smallest prime of the form $k^n - n$.\n\n*References:*\n- [A084046](https://oeis.org/A084046)-/\n\n@[expose] public section\n\nnamespace OeisA84046\n\n/-- Smallest prime $p$ such that $p + n$ is an $n$-th power, or $0$ if no such prime exists. -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  sInf {p : ℕ | p.Prime ∧ ∃ k : ℕ, k ^ n = p + n}\n\n/-- Value of the sequence `a` at 0. -/\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 0 := by\n  change sInf {p : ℕ | p.Prime ∧ ∃ k : ℕ, k ^ 0 = p + 0} = 0\n  have h_empty : {p : ℕ | p.Prime ∧ ∃ k : ℕ, k ^ 0 = p + 0} = ∅ := by\n    ext p\n    simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and]\n    intro hp ⟨k, hk⟩\n    rw [pow_zero, add_zero] at hk\n    subst hk\n    exact Nat.not_prime_one hp\n  rw [h_empty, Nat.sInf_empty]\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 2 := by\n  have h_least : IsLeast {p : ℕ | p.Prime ∧ ∃ k : ℕ, k ^ 1 = p + 1} 2 := by\n    constructor\n    · simp only [Set.mem_ofPred_eq]\n      refine ⟨Nat.prime_two, 3, by norm_num⟩\n    · intro p hp\n      simp only [Set.mem_ofPred_eq] at hp\n      exact hp.1.two_le\n  exact h_least.csInf_eq\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 2 := by\n  have h_least : IsLeast {p : ℕ | p.Prime ∧ ∃ k : ℕ, k ^ 2 = p + 2} 2 := by\n    constructor\n    · simp only [Set.mem_ofPred_eq]\n      refine ⟨Nat.prime_two, 2, by norm_num⟩\n    · intro p hp\n      simp only [Set.mem_ofPred_eq] at hp\n      exact hp.1.two_le\n  exact h_least.csInf_eq\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 5 := by\n  have h_least : IsLeast {p : ℕ | p.Prime ∧ ∃ k : ℕ, k ^ 3 = p + 3} 5 := by\n    constructor\n    · simp only [Set.mem_ofPred_eq]\n      refine ⟨by norm_num, 2, by norm_num⟩\n    · intro p hp\n      simp only [Set.mem_ofPred_eq] at hp\n      rcases hp with ⟨hp_prime, k, hk⟩\n      by_contra! h\n      interval_cases p\n      · exact Nat.not_prime_zero hp_prime\n      · exact Nat.not_prime_one hp_prime\n      · rcases (show k ≤ 1 ∨ 2 ≤ k by omega) with hk_le | hk_ge\n        · interval_cases k <;> revert hk <;> decide\n        · have : 8 ≤ k ^ 3 := by\n            calc 8 = 2 ^ 3 := by decide\n            _ ≤ k ^ 3 := Nat.pow_le_pow_left hk_ge 3\n          omega\n      · rcases (show k ≤ 1 ∨ 2 ≤ k by omega) with hk_le | hk_ge\n        · interval_cases k <;> revert hk <;> decide\n        · have : 8 ≤ k ^ 3 := by\n            calc 8 = 2 ^ 3 := by decide\n            _ ≤ k ^ 3 := Nat.pow_le_pow_left hk_ge 3\n          omega\n      · exact (by decide : ¬ Nat.Prime 4) hp_prime\n  exact h_least.csInf_eq\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture: if a(k) = 0 then k is an even square.\n\nThis is false for $k = 27$. Every candidate $x^{27} - 27$ factors as\n$(x^9 - 3)(x^{18} + 3x^9 + 9)$, so $a(27) = 0$, but $27$ is not an even square.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at\n  \"https://github.com/epoch-research/LeanOpenProblems-results/blob/f02efd9a8c5fc6a735d2a90c33e24f7278ce0ffc/runs/oeis-full-50usd-oai-jajpvieznaevpoyg/a084046_conjecture_0/Submission/Spec.lean#L17\"]\ntheorem conjecture : ¬ ∀ k : ℕ, a k = 0 → ∃ m : ℕ, k = (2 * m) ^ 2 := by\n  sorry\n\nend OeisA84046\n",
  "statement_hash": "da8977859ebe214e98ba9c5974259cb1a491756b3ea535b36f7847d65e9cf570",
  "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."
}