Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Smallest k≥1k \ge 1 such that the concatenation of kk threes and prime(n)\text{prime}(n) is prime

Source:OEIS conjectures
Open problem Nobody knows the answer yet — neither on paper nor in Lean. First verified proof: +100 points.
Statement:reviewed
Statement:

Conjecture: For n≥4n \ge 4, a(n)>0a(n) > 0.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.05845 [math.NT] · NS.05845v1 for this version
Declaration:OeisA242775.conjecture
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 100, later ones: 10; accepted critique: up to 60
Statement hash:aa9766f2d823e95a4f8a1cdf5f811d8e3a0d57496e4c278504c0ceae0fc36dbd
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/242775.lean

Formal statement

theorem conjecture (n : ℕ) (hn : 4 ≤ n) : 0 < a n
Show the full Challenge.lean (159 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Smallest $k \ge 1$ such that the concatenation of $k$ threes and $\text{prime}(n)$ is prime

Let $b_k = 3 \dots 3$ consist of $k \ge 1$ threes in base $10$. The sequence $a(n)$ is the smallest
$k \ge 1$ such that the decimal concatenation of $b_k$ and $\text{prime}(n)$ is prime, or
$a(n) = 0$ if no such prime exists.

*References:*
- [A242775](https://oeis.org/A242775)
-/

@[expose] public section

namespace OeisA242775

/-- The number formed by concatenating $k$ threes with $p$ in base $10$. -/
def concatThrees (k p : ℕ) : ℕ :=
  ((10 ^ k - 1) / 3) * (10 ^ max 1 (Nat.digits 10 p).length) + p

@[category API, AMS 11]
private lemma ten_pow_sub_one_div_three_ge_three {k : ℕ} (hk : 0 < k) :
    3 ≤ (10 ^ k - 1) / 3 := by
  have : 10 ^ 1 ≤ 10 ^ k := Nat.pow_le_pow_right (by decide) hk
  omega

@[category API, AMS 11]
private lemma three_dvd_ten_pow_sub_one_div_three (k : ℕ) :
    3 ∣ (10 ^ k - 1) / 3 := by
  induction k with
  | zero => simp
  | succ k ih =>
    have : 1 ≤ 10 ^ k := Nat.one_le_pow k 10 (by decide)
    have h2 : (10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3 := by
      omega
    rw [h2]
    exact dvd_add (dvd_mul_right 3 _) ih

/-- Smallest $k \ge 1$ such that the concatenation of $k$ threes and $\text{prime}(n)$ is prime,
or $0$ if no such prime exists. -/
noncomputable def a (n : ℕ) : ℕ :=
  if n = 0 then 0
  else sInf {k : ℕ | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime (n - 1)))}

@[category test, AMS 11]
theorem a_1 : a 1 = 0 := by
  dsimp [a]
  rw [Nat.nth_prime_zero_eq_two]
  suffices {k : ℕ | 0 < k ∧ (concatThrees k 2).Prime} = ∅ by simp [this]
  refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_
  have hval : concatThrees k 2 = ((10 ^ k - 1) / 3) * 10 + 2 := rfl
  have hdvd : 2 ∣ concatThrees k 2 := by
    rw [hval]
    exact dvd_add (dvd_mul_of_dvd_right (by decide) _) (dvd_refl 2)
  have hgt : 2 < concatThrees k 2 := by
    have := ten_pow_sub_one_div_three_ge_three hk
    omega
  rcases hp.eq_one_or_self_of_dvd 2 hdvd with h | h <;> omega

@[category test, AMS 11]
theorem a_2 : a 2 = 0 := by
  dsimp [a]
  rw [Nat.nth_prime_one_eq_three]
  suffices {k : ℕ | 0 < k ∧ (concatThrees k 3).Prime} = ∅ by simp [this]
  refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_
  have hval : concatThrees k 3 = ((10 ^ k - 1) / 3) * 10 + 3 := rfl
  have hdvd : 3 ∣ concatThrees k 3 := by
    rw [hval]
    exact dvd_add (dvd_mul_of_dvd_left (three_dvd_ten_pow_sub_one_div_three k) _) (dvd_refl 3)
  have hgt : 3 < concatThrees k 3 := by
    have := ten_pow_sub_one_div_three_ge_three hk
    omega
  rcases hp.eq_one_or_self_of_dvd 3 hdvd with h | h <;> omega

@[category test, AMS 11]
theorem a_3 : a 3 = 0 := by
  dsimp [a]
  rw [Nat.nth_prime_two_eq_five]
  suffices {k : ℕ | 0 < k ∧ (concatThrees k 5).Prime} = ∅ by simp [this]
  refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_
  have hval : concatThrees k 5 = ((10 ^ k - 1) / 3) * 10 + 5 := rfl
  have hdvd : 5 ∣ concatThrees k 5 := by
    rw [hval]
    exact dvd_add (dvd_mul_of_dvd_right (by decide) _) (dvd_refl 5)
  have hgt : 5 < concatThrees k 5 := by
    have := ten_pow_sub_one_div_three_ge_three hk
    omega
  rcases hp.eq_one_or_self_of_dvd 5 hdvd with h | h <;> omega

@[category test, AMS 11]
theorem a_4 : a 4 = 1 := by
  dsimp [a]
  rw [Nat.nth_prime_three_eq_seven]
  exact IsLeast.csInf_eq (by decide)

@[category test, AMS 11]
theorem a_5 : a 5 = 1 := by
  dsimp [a]
  rw [Nat.nth_prime_four_eq_eleven]
  have hlen : (Nat.digits 10 11).length = 2 := by decide
  exact IsLeast.csInf_eq ⟨⟨by decide, by simp only [concatThrees, hlen]; norm_num⟩,
    fun _ h => h.1⟩

@[category test, AMS 11]
theorem a_6 : a 6 = 1 := by
  dsimp [a]
  rw [Nat.nth_prime_five_eq_thirteen]
  have hlen : (Nat.digits 10 13).length = 2 := by decide
  exact IsLeast.csInf_eq ⟨⟨by decide, by simp only [concatThrees, hlen]; norm_num⟩,
    fun _ h => h.1⟩

@[category test, AMS 11]
theorem a_7 : a 7 = 1 := by
  dsimp [a]
  rw [Nat.nth_prime_six_eq_seventeen]
  have hlen : (Nat.digits 10 17).length = 2 := by decide
  exact IsLeast.csInf_eq ⟨⟨by decide, by simp only [concatThrees, hlen]; norm_num⟩,
    fun _ h => h.1⟩

@[category test, AMS 11]
theorem a_8 : a 8 = 2 := by
  dsimp [a]
  rw [Nat.nth_prime_seven_eq_nineteen]
  have hlen : (Nat.digits 10 19).length = 2 := by decide
  refine IsLeast.csInf_eq ⟨⟨by decide, ?_⟩, fun k ⟨hk, hp⟩ => ?_⟩
  · simp only [concatThrees, hlen]; norm_num
  · by_contra! hlt
    have hk1 : k = 1 := by omega
    subst hk1
    simp only [concatThrees, hlen] at hp
    exact absurd hp (by norm_num)

/--
Conjecture: For $n \ge 4$, $a(n) > 0$.
-/
@[category research open, AMS 11]
theorem conjecture (n : ℕ) (hn : 4 ≤ n) : 0 < a n := by
  sorry

end OeisA242775

To prove it: keep every definition of Challenge.lean unchanged and prove OeisA242775.conjecture with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_conjecture : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch oeis-242775
nosorry submit oeis-242775 nosorry/oeis-242775/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.