{
  "id": "5845",
  "ident": "NS.05845",
  "slug": "oeis-242775",
  "title": "Smallest $k \\ge 1$ such that the concatenation of $k$ threes and $\\text{prime}(n)$ is prime",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: For $n \\ge 4$, $a(n) > 0$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA242775.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) (hn : 4 ≤ n) : 0 < a n",
  "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 $k \\ge 1$ such that the concatenation of $k$ threes and $\\text{prime}(n)$ is prime\n\nLet $b_k = 3 \\dots 3$ consist of $k \\ge 1$ threes in base $10$. The sequence $a(n)$ is the smallest\n$k \\ge 1$ such that the decimal concatenation of $b_k$ and $\\text{prime}(n)$ is prime, or\n$a(n) = 0$ if no such prime exists.\n\n*References:*\n- [A242775](https://oeis.org/A242775)\n-/\n\n@[expose] public section\n\nnamespace OeisA242775\n\n/-- The number formed by concatenating $k$ threes with $p$ in base $10$. -/\ndef concatThrees (k p : ℕ) : ℕ :=\n  ((10 ^ k - 1) / 3) * (10 ^ max 1 (Nat.digits 10 p).length) + p\n\n@[category API, AMS 11]\nprivate lemma ten_pow_sub_one_div_three_ge_three {k : ℕ} (hk : 0 < k) :\n    3 ≤ (10 ^ k - 1) / 3 := by\n  have : 10 ^ 1 ≤ 10 ^ k := Nat.pow_le_pow_right (by decide) hk\n  omega\n\n@[category API, AMS 11]\nprivate lemma three_dvd_ten_pow_sub_one_div_three (k : ℕ) :\n    3 ∣ (10 ^ k - 1) / 3 := by\n  induction k with\n  | zero => simp\n  | succ k ih =>\n    have : 1 ≤ 10 ^ k := Nat.one_le_pow k 10 (by decide)\n    have h2 : (10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3 := by\n      omega\n    rw [h2]\n    exact dvd_add (dvd_mul_right 3 _) ih\n\n/-- Smallest $k \\ge 1$ such that the concatenation of $k$ threes and $\\text{prime}(n)$ is prime,\nor $0$ if no such prime exists. -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  if n = 0 then 0\n  else sInf {k : ℕ | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime (n - 1)))}\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by\n  dsimp [a]\n  rw [Nat.nth_prime_zero_eq_two]\n  suffices {k : ℕ | 0 < k ∧ (concatThrees k 2).Prime} = ∅ by simp [this]\n  refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_\n  have hval : concatThrees k 2 = ((10 ^ k - 1) / 3) * 10 + 2 := rfl\n  have hdvd : 2 ∣ concatThrees k 2 := by\n    rw [hval]\n    exact dvd_add (dvd_mul_of_dvd_right (by decide) _) (dvd_refl 2)\n  have hgt : 2 < concatThrees k 2 := by\n    have := ten_pow_sub_one_div_three_ge_three hk\n    omega\n  rcases hp.eq_one_or_self_of_dvd 2 hdvd with h | h <;> omega\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 0 := by\n  dsimp [a]\n  rw [Nat.nth_prime_one_eq_three]\n  suffices {k : ℕ | 0 < k ∧ (concatThrees k 3).Prime} = ∅ by simp [this]\n  refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_\n  have hval : concatThrees k 3 = ((10 ^ k - 1) / 3) * 10 + 3 := rfl\n  have hdvd : 3 ∣ concatThrees k 3 := by\n    rw [hval]\n    exact dvd_add (dvd_mul_of_dvd_left (three_dvd_ten_pow_sub_one_div_three k) _) (dvd_refl 3)\n  have hgt : 3 < concatThrees k 3 := by\n    have := ten_pow_sub_one_div_three_ge_three hk\n    omega\n  rcases hp.eq_one_or_self_of_dvd 3 hdvd with h | h <;> omega\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 0 := by\n  dsimp [a]\n  rw [Nat.nth_prime_two_eq_five]\n  suffices {k : ℕ | 0 < k ∧ (concatThrees k 5).Prime} = ∅ by simp [this]\n  refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_\n  have hval : concatThrees k 5 = ((10 ^ k - 1) / 3) * 10 + 5 := rfl\n  have hdvd : 5 ∣ concatThrees k 5 := by\n    rw [hval]\n    exact dvd_add (dvd_mul_of_dvd_right (by decide) _) (dvd_refl 5)\n  have hgt : 5 < concatThrees k 5 := by\n    have := ten_pow_sub_one_div_three_ge_three hk\n    omega\n  rcases hp.eq_one_or_self_of_dvd 5 hdvd with h | h <;> omega\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 1 := by\n  dsimp [a]\n  rw [Nat.nth_prime_three_eq_seven]\n  exact IsLeast.csInf_eq (by decide)\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 1 := by\n  dsimp [a]\n  rw [Nat.nth_prime_four_eq_eleven]\n  have hlen : (Nat.digits 10 11).length = 2 := by decide\n  exact IsLeast.csInf_eq ⟨⟨by decide, by simp only [concatThrees, hlen]; norm_num⟩,\n    fun _ h => h.1⟩\n\n@[category test, AMS 11]\ntheorem a_6 : a 6 = 1 := by\n  dsimp [a]\n  rw [Nat.nth_prime_five_eq_thirteen]\n  have hlen : (Nat.digits 10 13).length = 2 := by decide\n  exact IsLeast.csInf_eq ⟨⟨by decide, by simp only [concatThrees, hlen]; norm_num⟩,\n    fun _ h => h.1⟩\n\n@[category test, AMS 11]\ntheorem a_7 : a 7 = 1 := by\n  dsimp [a]\n  rw [Nat.nth_prime_six_eq_seventeen]\n  have hlen : (Nat.digits 10 17).length = 2 := by decide\n  exact IsLeast.csInf_eq ⟨⟨by decide, by simp only [concatThrees, hlen]; norm_num⟩,\n    fun _ h => h.1⟩\n\n@[category test, AMS 11]\ntheorem a_8 : a 8 = 2 := by\n  dsimp [a]\n  rw [Nat.nth_prime_seven_eq_nineteen]\n  have hlen : (Nat.digits 10 19).length = 2 := by decide\n  refine IsLeast.csInf_eq ⟨⟨by decide, ?_⟩, fun k ⟨hk, hp⟩ => ?_⟩\n  · simp only [concatThrees, hlen]; norm_num\n  · by_contra! hlt\n    have hk1 : k = 1 := by omega\n    subst hk1\n    simp only [concatThrees, hlen] at hp\n    exact absurd hp (by norm_num)\n\n/--\nConjecture: For $n \\ge 4$, $a(n) > 0$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture (n : ℕ) (hn : 4 ≤ n) : 0 < a n := by\n  sorry\n\nend OeisA242775\n",
  "statement_hash": "aa9766f2d823e95a4f8a1cdf5f811d8e3a0d57496e4c278504c0ceae0fc36dbd",
  "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."
}