{
  "id": "1003",
  "ident": "NS.01003",
  "slug": "erdos-1209",
  "title": "Erdős Problem 1209",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $A=\\{a_1<a_2<\\cdots\\}$ be a sequence of integers which tends to infinity sufficiently fast.\nIf there is an $n$ such that all $n+a_k$ are primes then must there exist infinitely many such $n$?\n\nErdős [Er80] wrote 'unless I overlook a trivial way of getting a counterexample these questions\nare quite hopeless'. There is indeed a trivial counterexample (a variant of the construction in\n[erdosproblems.com/429]): define $a_1=2$ and for $k\\geq 2$ let $a_k>a_{k-1}$ be a prime such that\n$a_k+k\\equiv 0\\pmod{q_k}$, where $q_k$ is some prime not dividing $k$. This sequence can be made to\ngrow arbitrarily fast\n\nSee also [erdosproblems.com/429] and [erdosproblems.com/1102].",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos1209.erdos_1209.parts.i",
  "statement_lean": "theorem erdos_1209.parts.i :\n    ¬ ∃ f : ℕ → ℕ, ∀ a : ℕ → ℕ, StrictMono a → (∀ k, f k ≤ a k) →\n      (∃ n, ∀ k, (n + a k).Prime) →\n      {n | ∀ k, (n + a k).Prime}.Infinite",
  "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# Erdős Problem 1209\n\n*References:*\n- [erdosproblems.com/429](https://www.erdosproblems.com/429)\n- [erdosproblems.com/1102](https://www.erdosproblems.com/1102)\n- [erdosproblems.com/1209](https://www.erdosproblems.com/1209)\n- [Er80] Erdős, Paul, A survey of problems in combinatorial number theory. Ann. Discrete Math.\n  (1980), 89-115.\n-/\n\n@[expose] public section\n\nopen Nat Set\n\nnamespace Erdos1209\n\n/-- For every `k ≥ 1` and bound `m`, there is a prime `p > m` such that `k + p` is composite:\ntake a prime `q > k` and, by Dirichlet, a prime `p > max m q` with `p ≡ -k (mod q)`. -/\n@[category API, AMS 11]\ntheorem exists_prime_gt_not_prime_add (k m : ℕ) (hk : 1 ≤ k) :\n    ∃ p, m < p ∧ p.Prime ∧ ¬ (k + p).Prime := by\n  obtain ⟨q, hqk, hq⟩ := Nat.exists_infinite_primes (k + 1)\n  have : NeZero q := ⟨hq.ne_zero⟩\n  have hunit : IsUnit (-(k : ZMod q)) := by\n    refine IsUnit.neg ?_\n    rw [ZMod.isUnit_iff_coprime]\n    exact (Nat.coprime_comm.1 ((Nat.Prime.coprime_iff_not_dvd hq).2\n      (Nat.not_dvd_of_pos_of_lt (by omega) (by omega))))\n  obtain ⟨p, hp, hpp, hpq⟩ := Nat.forall_exists_prime_gt_and_eq_mod hunit (max m q)\n  refine ⟨p, by omega, hpp, ?_⟩\n  have hdvd : q ∣ k + p := by\n    rw [← ZMod.natCast_eq_zero_iff, Nat.cast_add, hpq]\n    ring\n  exact Nat.not_prime_of_dvd_of_lt hdvd hq.two_le (by omega)\n\n/-- The counterexample sequence: `a 0` is a prime at least `f 0`, and `a (k + 1)` is a prime\nlarger than `a k` and `f (k + 1)` with `(k + 1) + a (k + 1)` composite. -/\nnoncomputable def seq (f : ℕ → ℕ) : ℕ → ℕ\n  | 0 => Classical.choose (Nat.exists_infinite_primes (f 0))\n  | k + 1 => Classical.choose (exists_prime_gt_not_prime_add (k + 1) (max (seq f k) (f (k + 1)))\n      (by omega))\n\n/-- The defining properties of `seq f 0`. -/\n@[category API, AMS 11]\ntheorem seq_zero_spec (f : ℕ → ℕ) : f 0 ≤ seq f 0 ∧ (seq f 0).Prime :=\n  Classical.choose_spec (Nat.exists_infinite_primes (f 0))\n\n/-- The defining properties of `seq f (k + 1)`. -/\n@[category API, AMS 11]\ntheorem seq_succ_spec (f : ℕ → ℕ) (k : ℕ) :\n    max (seq f k) (f (k + 1)) < seq f (k + 1) ∧ (seq f (k + 1)).Prime ∧\n      ¬ ((k + 1) + seq f (k + 1)).Prime :=\n  Classical.choose_spec (exists_prime_gt_not_prime_add (k + 1) (max (seq f k) (f (k + 1)))\n    (by omega))\n\n/--\nLet $A=\\{a_1<a_2<\\cdots\\}$ be a sequence of integers which tends to infinity sufficiently fast.\nIf there is an $n$ such that all $n+a_k$ are primes then must there exist infinitely many such $n$?\n\nErdős [Er80] wrote 'unless I overlook a trivial way of getting a counterexample these questions\nare quite hopeless'. There is indeed a trivial counterexample (a variant of the construction in\n[erdosproblems.com/429]): define $a_1=2$ and for $k\\geq 2$ let $a_k>a_{k-1}$ be a prime such that\n$a_k+k\\equiv 0\\pmod{q_k}$, where $q_k$ is some prime not dividing $k$. This sequence can be made to\ngrow arbitrarily fast\n\nSee also [erdosproblems.com/429] and [erdosproblems.com/1102].\n-/\n@[category research solved, question, AMS 11]\ntheorem erdos_1209.parts.i :\n    ¬ ∃ f : ℕ → ℕ, ∀ a : ℕ → ℕ, StrictMono a → (∀ k, f k ≤ a k) →\n      (∃ n, ∀ k, (n + a k).Prime) →\n      {n | ∀ k, (n + a k).Prime}.Infinite := by\n  rintro ⟨f, hf⟩\n  have hmono : StrictMono (seq f) :=\n    strictMono_nat_of_lt_succ fun k => lt_of_le_of_lt (le_max_left _ _) (seq_succ_spec f k).1\n  have hbound : ∀ k, f k ≤ seq f k := by\n    intro k\n    cases k with\n    | zero => exact (seq_zero_spec f).1\n    | succ k => exact (lt_of_le_of_lt (le_max_right _ _) (seq_succ_spec f k).1).le\n  have hprime : ∀ k, (seq f k).Prime := by\n    intro k\n    cases k with\n    | zero => exact (seq_zero_spec f).2\n    | succ k => exact (seq_succ_spec f k).2.1\n  have hinf := hf (seq f) hmono hbound ⟨0, fun k => by simpa using hprime k⟩\n  -- but the set is contained in `{0}`\n  refine hinf ((Set.finite_singleton 0).subset fun n hn => ?_)\n  rw [Set.mem_singleton_iff]\n  by_contra hn0\n  exact (seq_succ_spec f (n - 1)).2.2 (by\n    have := hn n\n    rwa [show n - 1 + 1 = n by omega] )\n\n\n/-- For every `k ≥ 1` and bound `m`, there is a prime `p > m` such that `k + p` is not squarefree:\ntake a prime `q > k` and, by Dirichlet, a prime `p > m` with `p ≡ -k (mod q ^ 2)`. -/\n@[category API, AMS 11]\ntheorem exists_prime_gt_not_squarefree_add (k m : ℕ) (hk : 1 ≤ k) :\n    ∃ p, m < p ∧ p.Prime ∧ ¬ Squarefree (k + p) := by\n  obtain ⟨q, hqk, hq⟩ := Nat.exists_infinite_primes (k + 1)\n  have : NeZero (q ^ 2) := ⟨pow_ne_zero 2 hq.ne_zero⟩\n  have hunit : IsUnit (-(k : ZMod (q ^ 2))) := by\n    refine IsUnit.neg ?_\n    rw [ZMod.isUnit_iff_coprime]\n    exact Nat.Coprime.pow_right 2 (Nat.coprime_comm.1 ((Nat.Prime.coprime_iff_not_dvd hq).2\n      (Nat.not_dvd_of_pos_of_lt (by omega) (by omega))))\n  obtain ⟨p, hp, hpp, hpq⟩ := Nat.forall_exists_prime_gt_and_eq_mod hunit m\n  refine ⟨p, hp, hpp, ?_⟩\n  have hdvd : q ^ 2 ∣ k + p := by\n    rw [← ZMod.natCast_eq_zero_iff, Nat.cast_add, hpq]\n    ring\n  rw [Nat.squarefree_iff_prime_squarefree]\n  push Not\n  exact ⟨q, hq, by rwa [← sq]⟩\n\n/-- The counterexample sequence for the squarefree variant. -/\nnoncomputable def seq' (f : ℕ → ℕ) : ℕ → ℕ\n  | 0 => Classical.choose (Nat.exists_infinite_primes (f 0))\n  | k + 1 => Classical.choose (exists_prime_gt_not_squarefree_add (k + 1)\n      (max (seq' f k) (f (k + 1))) (by omega))\n\n/-- The defining properties of `seq' f (k + 1)`. -/\n@[category API, AMS 11]\ntheorem seq'_succ_spec (f : ℕ → ℕ) (k : ℕ) :\n    max (seq' f k) (f (k + 1)) < seq' f (k + 1) ∧ (seq' f (k + 1)).Prime ∧\n      ¬ Squarefree ((k + 1) + seq' f (k + 1)) :=\n  Classical.choose_spec (exists_prime_gt_not_squarefree_add (k + 1) (max (seq' f k) (f (k + 1)))\n    (by omega))\n\n/--\nWhat if we ask for $n+a_k$ to be squarefree instead of prime?\n\nA similar construction provides a counterexample to the squarefree question.\n-/\n@[category research solved, question, AMS 11]\ntheorem erdos_1209.parts.ii :\n    ¬ ∃ f : ℕ → ℕ, ∀ a : ℕ → ℕ, StrictMono a → (∀ k, f k ≤ a k) →\n      (∃ n, ∀ k, Squarefree (n + a k)) →\n      {n | ∀ k, Squarefree (n + a k)}.Infinite := by\n  rintro ⟨f, hf⟩\n  have h0 := Classical.choose_spec (Nat.exists_infinite_primes (f 0))\n  have hmono : StrictMono (seq' f) :=\n    strictMono_nat_of_lt_succ fun k => lt_of_le_of_lt (le_max_left _ _) (seq'_succ_spec f k).1\n  have hbound : ∀ k, f k ≤ seq' f k := by\n    intro k\n    cases k with\n    | zero => exact h0.1\n    | succ k => exact (lt_of_le_of_lt (le_max_right _ _) (seq'_succ_spec f k).1).le\n  have hprime : ∀ k, (seq' f k).Prime := by\n    intro k\n    cases k with\n    | zero => exact h0.2\n    | succ k => exact (seq'_succ_spec f k).2.1\n  have hinf := hf (seq' f) hmono hbound\n    ⟨0, fun k => by simpa using (hprime k).prime.squarefree⟩\n  refine hinf ((Set.finite_singleton 0).subset fun n hn => ?_)\n  rw [Set.mem_singleton_iff]\n  by_contra hn0\n  exact (seq'_succ_spec f (n - 1)).2.2 (by\n    have := hn n\n    rwa [show n - 1 + 1 = n by omega])\n\n\nset_option linter.style.formal_proof_palomar false in\n/--\nAre there $n$ such that $n+2^{2^k}$ is always a prime?\n\nebarschkis and GPT have proved that there are no $n$ such that $n+2^{2^k}$ is always prime: let\n$n\\geq 3$ be any odd integer. If $k$ is chosen sufficiently large, and $p=n+2^{2^{k}}$ is prime,\nthen the multiplicative order of $2^{2^k}\\pmod{p}$, say $m$ is odd, and hence if $l$ is chosen such\nthat $2^l\\equiv 1\\pmod{m}$ then $p\\mid n+2^{2^{k+rl}}$ for all $r\\geq 1$.\n\nThis was formalized in Lean by Barschkis using ChatGPT.\n-/\n@[category research solved, question, AMS 11, formal_proof using lean4 at \"https://github.com/ebarschkis/ErdosProblem/blob/main/Problem1209/Formalization.lean\"]\ntheorem erdos_1209.parts.iii.a :\n    ¬ ∃ n : ℕ, ∀ k : ℕ, (n + 2 ^ (2 ^ k)).Prime := by\n  sorry\n\n/--\nAre there $n$ such that $n+2^{2^k}$ is always squarefree?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_1209.parts.iii.b :\n    ∃ n : ℕ, ∀ k : ℕ, Squarefree (n + 2 ^ (2 ^ k)) := by\n  sorry\n\n/--\nAre there $n$ such that $n+2^{2^k}$ is infinitely often a prime?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_1209.parts.iii.c :\n    ∃ n : ℕ, {k | (n + 2 ^ (2 ^ k)).Prime}.Infinite := by\n  sorry\n\n/--\nAre there $n$ such that $n+2^{2^k}$ is infinitely often squarefree?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_1209.parts.iii.d :\n    ∃ n : ℕ, {k | Squarefree (n + 2 ^ (2 ^ k))}.Infinite := by\n  sorry\n\nend Erdos1209\n",
  "statement_hash": "590753cec278df1bcaf4ac269dfbaa20bc8a859cd5d80e685c795640d28b2416",
  "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."
}