{
  "id": "2030",
  "ident": "NS.02030",
  "slug": "erdos-409",
  "title": "Erdős Problem 409",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": null,
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/409",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos409.erdos_409.parts.i",
  "statement_lean": "theorem erdos_409.parts.i (n : ℕ) (hn : 0 < n) :\n    IsLeast { i | (φ · + 1)^[i] n |>.Prime } (erdos_409.parts.i.answer n)",
  "challenge_source": "/-\nCopyright 2025 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# Erdős Problem 409\n\n*Reference:* [erdosproblems.com/409](https://www.erdosproblems.com/409)\n-/\n\n@[expose] public section\n\nopen scoped Topology ArithmeticFunction.sigma Nat\nopen Filter\n\nnamespace Erdos409\n\ndef erdos_409.parts.i.answer (n : ℕ) : ℕ := sorry\n\n/--\nHow many iterations of $n\\mapsto\\phi(n) + 1$ are needed before a prime is reached?\n-/\n-- Formalisation note: the sequence of iterates always terminates if `n > 0`\n-- since it is strictly decreasing unless the input is prime, at which point\n-- it becomes static. See also https://oeis.org/A39651\n@[category research open, question value, AMS 11]\ntheorem erdos_409.parts.i (n : ℕ) (hn : 0 < n) :\n    IsLeast { i | (φ · + 1)^[i] n |>.Prime } (erdos_409.parts.i.answer n) := by\n  sorry\n\n/-- If $n > 0$, then the iteration $n\\mapsto\\phi(n) + 1$ necessarily\nreaches a prime. -/\n@[category test, AMS 11]\ntheorem erdos_409.variants.termination (n : ℕ) (hn : 0 < n) :\n    ∃ i, (φ · + 1)^[i] n |>.Prime := by\n  induction n using Nat.strong_induction_on with\n  | _ n ih =>\n    by_cases hp : n.Prime\n    · exact ⟨0, by simpa using hp⟩\n    · have h1 : n = 1 ∨ 1 < n := by omega\n      rcases h1 with h1 | h1\n      · subst h1\n        refine ⟨1, ?_⟩\n        norm_num [Function.iterate_one, Nat.totient_one]\n      · have hlt : φ n < n := Nat.totient_lt n h1\n        have hne : φ n ≠ n - 1 := by\n          intro h\n          exact hp ((Nat.totient_eq_iff_prime hn).1 h)\n        have hdec : φ n + 1 < n := by omega\n        have hpos : 0 < φ n + 1 := by positivity\n        obtain ⟨i, hi⟩ := ih (φ n + 1) hdec hpos\n        refine ⟨i + 1, ?_⟩\n        rw [Function.iterate_succ_apply]\n        exact hi\n\n-- Formalisation note: it's possible that solution to `erdos_409.parts.i` needs to be\n-- expressed asymptotically. To handle this we include `IsTheta`, `IsBigO`\n-- and `IsLittleO` variants below. Since a solution is not known this necessitates\n-- the use of an `answer` definition left as `sorry`. Trivial or sub-optimal solutions\n-- will therefore exist to the asymptotic formalisations. A true solution to\n-- the asymptotic variants should have a degree of optimality or non-triviality to it.\ndef erdos_409.parts.i.isTheta.answer : ℕ → ℝ := sorry\n\n/--\nLet $c(n)$ be the minimum number of iterations of $n\\mapsto\\phi(n) + 1$ before a prime\nis reached. What is $\\Theta(c(n))$?\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_409.parts.i.isTheta (c : ℕ → ℕ)\n    (h : ∀ n > 0, IsLeast { i | (φ · + 1)^[i] n |>.Prime } (c n)) :\n    (fun n => (c n : ℝ)) =Θ[atTop] erdos_409.parts.i.isTheta.answer := by\n  sorry\n\ndef erdos_409.parts.i.isBigO.answer : ℕ → ℝ := sorry\n\n/--\nLet $c(n)$ be the minimum number of iterations of $n\\mapsto\\phi(n) + 1$ before a prime\nis reached. Find the simplest function $g(n)$ such that $c(n) = O(g(n))$?\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_409.parts.i.isBigO (c : ℕ → ℕ)\n    (h : ∀ n > 0, IsLeast { i | (φ · + 1)^[i] n |>.Prime } (c n)) :\n    (fun n => (c n : ℝ)) =O[atTop] erdos_409.parts.i.isBigO.answer := by\n  sorry\n\ndef erdos_409.parts.i.isLittleO.answer : ℕ → ℝ := sorry\n\n/--\nLet $c(n)$ be the minimum number of iterations of $n\\mapsto\\phi(n) + 1$ before a prime\nis reached. Find the simplest function $g(n)$ such that $c(n) = o(g(n))$?\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_409.parts.i.isLittleO (c : ℕ → ℕ)\n    (h : ∀ n > 0, IsLeast { i | (φ · + 1)^[i] n |>.Prime } (c n)) :\n    (fun n => (c n : ℝ)) =o[atTop] erdos_409.parts.i.isLittleO.answer := by\n  sorry\n\n/--\nCan infinitely many $n$ reach the same prime under the iteration $n\\mapsto\\phi(n) + 1$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_409.parts.ii :\n    ∃ (p : ℕ) (hp : p.Prime), { n | ∃ i, (φ · + 1)^[i] n = p }.Infinite := by\n  sorry\n\ndef erdos_409.parts.iii.answer : ℝ := sorry\n\n/--\nWhat is the density of $n$ which reach any fixed prime under the iteration $n\\mapsto\\phi(n) + 1$?\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_409.parts.iii (p : ℕ) (h : p.Prime) :\n    { n | ∃ i, (φ · + 1)^[i] n = p }.HasDensity erdos_409.parts.iii.answer := by\n  sorry\n\ndef erdos_409.variants.sigma.answer (n : ℕ) : ℕ := sorry\n\n/--\nIf the iteration $n\\mapsto\\sigma(n) - 1$ starting at $n > 1$ reaches a prime, how many\niterations are needed before a prime is reached?\n-/\n-- Formalisation note: termination of this sequence is not known in general since\n-- it is strictly increasing except at primes, so it is assumed as a hypothesis.\n@[category research open, question value, AMS 11]\ntheorem erdos_409.variants.sigma (n : ℕ) (hn : n > 1)\n    (hterm : ∃ i, (σ 1 · - 1)^[i] n |>.Prime) :\n    IsLeast { i | (σ 1 · - 1)^[i] n |>.Prime } (erdos_409.variants.sigma.answer n) := by\n  sorry\n\n/-- If $n > 1$ then the iteration $n\\mapsto\\sigma(n) - 1$ necessarily reaches a prime.\nNote: this is open — it is not clear that the σ iteration always terminates,\nsince it is non-decreasing (unlike the φ iteration which is strictly decreasing). -/\n@[category research open, AMS 11]\ntheorem erdos_409.variants.sigma_termination (n : ℕ) (hn : n > 1) :\n    ∃ i, (σ 1 · - 1)^[i] n |>.Prime := by\n  sorry\n\n-- Formalisation note: See the above formalisation note for the rationale\n-- for including asymptotic variants\ndef erdos_409.variants.sigma_isTheta.answer : ℕ → ℝ := sorry\n\n/--\nLet $c(n)$ be the minimum number of iterations of $n\\mapsto\\sigma(n) - 1$ before a prime\nis reached. What is $\\Theta(c(n))$?\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_409.variants.sigma_isTheta (c : ℕ → ℕ)\n    (h : ∀ n > 1, IsLeast { i | (σ 1 · - 1)^[i] n |>.Prime } (c n)) :\n    (fun n => (c n : ℝ)) =Θ[atTop] erdos_409.variants.sigma_isTheta.answer := by\n  sorry\n\ndef erdos_409.variants.sigma_isBigO.answer : ℕ → ℝ := sorry\n\n/--\nLet $c(n)$ be the minimum number of iterations of $n\\mapsto\\sigma(n) - 1$ before a prime\nis reached. Find the simplest function $g(n)$ such that $c(n) = O(g(n))$?\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_409.variants.sigma_isBigO (c : ℕ → ℕ)\n    (h : ∀ n > 1, IsLeast { i | (σ 1 · - 1)^[i] n |>.Prime } (c n)) :\n    (fun n => (c n : ℝ)) =O[atTop] erdos_409.variants.sigma_isBigO.answer := by\n  sorry\n\ndef erdos_409.variants.sigma_isLittleO.answer : ℕ → ℝ := sorry\n\n/--\nLet $c(n)$ be the minimum number of iterations of $n\\mapsto\\sigma(n) - 1$ before a prime\nis reached. Find the simplest function $g(n)$ such that $c(n) = o(g(n))$?\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_409.variants.sigma_isLittleO (c : ℕ → ℕ)\n    (h : ∀ n > 1, IsLeast { i | (σ 1 · - 1)^[i] n |>.Prime } (c n)) :\n    (fun n => (c n : ℝ)) =o[atTop] erdos_409.variants.sigma_isLittleO.answer := by\n  sorry\n\n/--\nIs it true that iterates of $n\\mapsto\\sigma(n) - 1$ always reach a prime?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_409.variants.sigma_prime_termination :\n    ∀ n > 1, ∃ i, (σ 1 · - 1)^[i] n |>.Prime := by\n  sorry\n\nend Erdos409\n",
  "statement_hash": "2789550716fbb27aaad05182bea95b9b46f36888a1c9f943f68405854dd36d0c",
  "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."
}