/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
module
public import FormalConjecturesUtilSmallest $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:
@[expose] public sectionnamespace OeisA242775The 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) + pk:ℕhk:0 < kthis:10 ^ 1 ≤ 10 ^ k⊢ 3 ≤ (10 ^ k - 1) / 3
omega All goals completed! 🐙
@[category API, AMS 11]
private lemma three_dvd_ten_pow_sub_one_div_three (k : ℕ) :
3 ∣ (10 ^ k - 1) / 3 := by k:ℕ⊢ 3 ∣ (10 ^ k - 1) / 3
induction k with
| zero => zero ⊢ 3 ∣ (10 ^ 0 - 1) / 3 simp All goals completed! 🐙
| succ k ih => succ k:ℕih:3 ∣ (10 ^ k - 1) / 3⊢ 3 ∣ (10 ^ (k + 1) - 1) / 3
have : 1 ≤ 10 ^ k := Nat.one_le_pow k 10 (by k:ℕih:3 ∣ (10 ^ k - 1) / 3⊢ 0 < 10 succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ k⊢ 3 ∣ (10 ^ (k + 1) - 1) / 3 decide All goals completed! 🐙 succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ k⊢ 3 ∣ (10 ^ (k + 1) - 1) / 3)succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ k⊢ 3 ∣ (10 ^ (k + 1) - 1) / 3
have h2 : (10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3 := by k:ℕ⊢ 3 ∣ (10 ^ k - 1) / 3 succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ kh2:(10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3⊢ 3 ∣ (10 ^ (k + 1) - 1) / 3
omegasucc k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ kh2:(10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3⊢ 3 ∣ (10 ^ (k + 1) - 1) / 3succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ kh2:(10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3⊢ 3 ∣ (10 ^ (k + 1) - 1) / 3
rw [h2 succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ kh2:(10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3⊢ 3 ∣ 3 * 10 ^ k + (10 ^ k - 1) / 3 succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ kh2:(10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3⊢ 3 ∣ 3 * 10 ^ k + (10 ^ k - 1) / 3]succ k:ℕih:3 ∣ (10 ^ k - 1) / 3this:1 ≤ 10 ^ kh2:(10 ^ (k + 1) - 1) / 3 = 3 * 10 ^ k + (10 ^ k - 1) / 3⊢ 3 ∣ 3 * 10 ^ k + (10 ^ k - 1) / 3
exact dvd_add (dvd_mul_right 3 _) ih All goals completed! 🐙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 ⊢ a 1 = 0
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 0))} = 0
rw [Nat.nth_prime_zero_eq_two ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = 0 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = 0] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = 0
suffices {k : ℕ | 0 < k ∧ (concatThrees k 2).Prime} = ∅ by this:{k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = ∅⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = 0 ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = ∅ simp [this] ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = ∅ ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)} = ∅
refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_ k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)⊢ False
have hval : concatThrees k 2 = ((10 ^ k - 1) / 3) * 10 + 2 := rfl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2⊢ False
have hdvd : 2 ∣ concatThrees k 2 := by ⊢ a 1 = 0 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2⊢ False
rw [hval k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2⊢ 2 ∣ (10 ^ k - 1) / 3 * 10 + 2 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2⊢ 2 ∣ (10 ^ k - 1) / 3 * 10 + 2 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2⊢ False] k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2⊢ 2 ∣ (10 ^ k - 1) / 3 * 10 + 2 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2⊢ False
exact dvd_add (dvd_mul_of_dvd_right (by k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2⊢ 2 ∣ 10 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2⊢ False decide All goals completed! 🐙 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2⊢ False) _) (dvd_refl 2) k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2⊢ False
have hgt : 2 < concatThrees k 2 := by ⊢ a 1 = 0 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2⊢ False
have := ten_pow_sub_one_div_three_ge_three hk k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2this:3 ≤ (10 ^ k - 1) / 3⊢ 2 < concatThrees k 2 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2⊢ False
omega k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2⊢ False k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2⊢ False
rcases hp.eq_one_or_self_of_dvd 2 hdvd with h | h inl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2h:2 = 1⊢ Falseinr k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2h:2 = concatThrees k 2⊢ False <;> inl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2h:2 = 1⊢ Falseinr k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 2)}hk:0 < khp:Nat.Prime (concatThrees k 2)hval:concatThrees k 2 = (10 ^ k - 1) / 3 * 10 + 2hdvd:2 ∣ concatThrees k 2hgt:2 < concatThrees k 2h:2 = concatThrees k 2⊢ False omega All goals completed! 🐙
@[category test, AMS 11]
theorem a_2 : a 2 = 0 := by ⊢ a 2 = 0
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 1))} = 0
rw [Nat.nth_prime_one_eq_three ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = 0 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = 0] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = 0
suffices {k : ℕ | 0 < k ∧ (concatThrees k 3).Prime} = ∅ by this:{k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = ∅⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = 0 ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = ∅ simp [this] ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = ∅ ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)} = ∅
refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_ k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)⊢ False
have hval : concatThrees k 3 = ((10 ^ k - 1) / 3) * 10 + 3 := rfl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3⊢ False
have hdvd : 3 ∣ concatThrees k 3 := by ⊢ a 2 = 0 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3⊢ False
rw [hval k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3⊢ 3 ∣ (10 ^ k - 1) / 3 * 10 + 3 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3⊢ 3 ∣ (10 ^ k - 1) / 3 * 10 + 3 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3⊢ False] k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3⊢ 3 ∣ (10 ^ k - 1) / 3 * 10 + 3 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3⊢ False
exact dvd_add (dvd_mul_of_dvd_left (three_dvd_ten_pow_sub_one_div_three k) _) (dvd_refl 3) k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3⊢ False k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3⊢ False
have hgt : 3 < concatThrees k 3 := by ⊢ a 2 = 0 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3⊢ False
have := ten_pow_sub_one_div_three_ge_three hk k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3this:3 ≤ (10 ^ k - 1) / 3⊢ 3 < concatThrees k 3 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3⊢ False
omega k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3⊢ False k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3⊢ False
rcases hp.eq_one_or_self_of_dvd 3 hdvd with h | h inl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3h:3 = 1⊢ Falseinr k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3h:3 = concatThrees k 3⊢ False <;> inl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3h:3 = 1⊢ Falseinr k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 3)}hk:0 < khp:Nat.Prime (concatThrees k 3)hval:concatThrees k 3 = (10 ^ k - 1) / 3 * 10 + 3hdvd:3 ∣ concatThrees k 3hgt:3 < concatThrees k 3h:3 = concatThrees k 3⊢ False omega All goals completed! 🐙
@[category test, AMS 11]
theorem a_3 : a 3 = 0 := by ⊢ a 3 = 0
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 2))} = 0
rw [Nat.nth_prime_two_eq_five ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = 0 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = 0] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = 0
suffices {k : ℕ | 0 < k ∧ (concatThrees k 5).Prime} = ∅ by this:{k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = ∅⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = 0 ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = ∅ simp [this] ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = ∅ ⊢ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)} = ∅
refine Set.eq_empty_of_forall_notMem fun k ⟨hk, hp⟩ => ?_ k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)⊢ False
have hval : concatThrees k 5 = ((10 ^ k - 1) / 3) * 10 + 5 := rfl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5⊢ False
have hdvd : 5 ∣ concatThrees k 5 := by ⊢ a 3 = 0 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5⊢ False
rw [hval k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5⊢ 5 ∣ (10 ^ k - 1) / 3 * 10 + 5 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5⊢ 5 ∣ (10 ^ k - 1) / 3 * 10 + 5 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5⊢ False] k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5⊢ 5 ∣ (10 ^ k - 1) / 3 * 10 + 5 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5⊢ False
exact dvd_add (dvd_mul_of_dvd_right (by k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5⊢ 5 ∣ 10 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5⊢ False decide All goals completed! 🐙 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5⊢ False) _) (dvd_refl 5) k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5⊢ False
have hgt : 5 < concatThrees k 5 := by ⊢ a 3 = 0 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5⊢ False
have := ten_pow_sub_one_div_three_ge_three hk k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5this:3 ≤ (10 ^ k - 1) / 3⊢ 5 < concatThrees k 5 k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5⊢ False
omega k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5⊢ False k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5⊢ False
rcases hp.eq_one_or_self_of_dvd 5 hdvd with h | h inl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5h:5 = 1⊢ Falseinr k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5h:5 = concatThrees k 5⊢ False <;> inl k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5h:5 = 1⊢ Falseinr k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 5)}hk:0 < khp:Nat.Prime (concatThrees k 5)hval:concatThrees k 5 = (10 ^ k - 1) / 3 * 10 + 5hdvd:5 ∣ concatThrees k 5hgt:5 < concatThrees k 5h:5 = concatThrees k 5⊢ False omega All goals completed! 🐙
@[category test, AMS 11]
theorem a_4 : a 4 = 1 := by ⊢ a 4 = 1
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 3))} = 1
rw [Nat.nth_prime_three_eq_seven ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 7)} = 1 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 7)} = 1] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 7)} = 1
exact IsLeast.csInf_eq (by ⊢ IsLeast {k | 0 < k ∧ Nat.Prime (concatThrees k 7)} 1 decide All goals completed! 🐙)
@[category test, AMS 11]
theorem a_5 : a 5 = 1 := by ⊢ a 5 = 1
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 4))} = 1
rw [Nat.nth_prime_four_eq_eleven ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 11)} = 1 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 11)} = 1] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 11)} = 1
have hlen : (Nat.digits 10 11).length = 2 := by ⊢ a 5 = 1 hlen:(Nat.digits 10 11).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 11)} = 1 decide hlen:(Nat.digits 10 11).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 11)} = 1 hlen:(Nat.digits 10 11).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 11)} = 1
exact IsLeast.csInf_eq ⟨⟨by hlen:(Nat.digits 10 11).length = 2⊢ 0 < 1 decide All goals completed! 🐙, by hlen:(Nat.digits 10 11).length = 2⊢ Nat.Prime (concatThrees 1 11) simp only [concatThrees, hlen] hlen:(Nat.digits 10 11).length = 2⊢ Nat.Prime ((10 ^ 1 - 1) / 3 * 10 ^ max 1 2 + 11); norm_num All goals completed! 🐙⟩,
fun _ h => h.1⟩
@[category test, AMS 11]
theorem a_6 : a 6 = 1 := by ⊢ a 6 = 1
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 5))} = 1
rw [Nat.nth_prime_five_eq_thirteen ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 13)} = 1 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 13)} = 1] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 13)} = 1
have hlen : (Nat.digits 10 13).length = 2 := by ⊢ a 6 = 1 hlen:(Nat.digits 10 13).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 13)} = 1 decide hlen:(Nat.digits 10 13).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 13)} = 1 hlen:(Nat.digits 10 13).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 13)} = 1
exact IsLeast.csInf_eq ⟨⟨by hlen:(Nat.digits 10 13).length = 2⊢ 0 < 1 decide All goals completed! 🐙, by hlen:(Nat.digits 10 13).length = 2⊢ Nat.Prime (concatThrees 1 13) simp only [concatThrees, hlen] hlen:(Nat.digits 10 13).length = 2⊢ Nat.Prime ((10 ^ 1 - 1) / 3 * 10 ^ max 1 2 + 13); norm_num All goals completed! 🐙⟩,
fun _ h => h.1⟩
@[category test, AMS 11]
theorem a_7 : a 7 = 1 := by ⊢ a 7 = 1
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 6))} = 1
rw [Nat.nth_prime_six_eq_seventeen ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 17)} = 1 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 17)} = 1] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 17)} = 1
have hlen : (Nat.digits 10 17).length = 2 := by ⊢ a 7 = 1 hlen:(Nat.digits 10 17).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 17)} = 1 decide hlen:(Nat.digits 10 17).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 17)} = 1 hlen:(Nat.digits 10 17).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 17)} = 1
exact IsLeast.csInf_eq ⟨⟨by hlen:(Nat.digits 10 17).length = 2⊢ 0 < 1 decide All goals completed! 🐙, by hlen:(Nat.digits 10 17).length = 2⊢ Nat.Prime (concatThrees 1 17) simp only [concatThrees, hlen] hlen:(Nat.digits 10 17).length = 2⊢ Nat.Prime ((10 ^ 1 - 1) / 3 * 10 ^ max 1 2 + 17); norm_num All goals completed! 🐙⟩,
fun _ h => h.1⟩
@[category test, AMS 11]
theorem a_8 : a 8 = 2 := by ⊢ a 8 = 2
dsimp [a] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k (Nat.nth Nat.Prime 7))} = 2
rw [Nat.nth_prime_seven_eq_nineteen ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 19)} = 2 ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 19)} = 2] ⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 19)} = 2
have hlen : (Nat.digits 10 19).length = 2 := by ⊢ a 8 = 2 hlen:(Nat.digits 10 19).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 19)} = 2 decide hlen:(Nat.digits 10 19).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 19)} = 2 hlen:(Nat.digits 10 19).length = 2⊢ sInf {k | 0 < k ∧ Nat.Prime (concatThrees k 19)} = 2
refine IsLeast.csInf_eq ⟨⟨by hlen:(Nat.digits 10 19).length = 2⊢ 0 < 2 decide All goals completed! 🐙, ?_⟩, fun k ⟨hk, hp⟩ => ?_⟩
· refine_1 hlen:(Nat.digits 10 19).length = 2⊢ Nat.Prime (concatThrees 2 19) simp only [concatThrees, hlen] refine_1 hlen:(Nat.digits 10 19).length = 2⊢ Nat.Prime ((10 ^ 2 - 1) / 3 * 10 ^ max 1 2 + 19); norm_num All goals completed! 🐙
· refine_2 hlen:(Nat.digits 10 19).length = 2k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < khp:Nat.Prime (concatThrees k 19)⊢ 2 ≤ k by_contra! hlt refine_2 hlen:(Nat.digits 10 19).length = 2k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < khp:Nat.Prime (concatThrees k 19)hlt:k < 2⊢ False
have hk1 : k = 1 := by ⊢ a 8 = 2 refine_2 hlen:(Nat.digits 10 19).length = 2k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < khp:Nat.Prime (concatThrees k 19)hlt:k < 2hk1:k = 1⊢ False omegarefine_2 hlen:(Nat.digits 10 19).length = 2k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < khp:Nat.Prime (concatThrees k 19)hlt:k < 2hk1:k = 1⊢ Falserefine_2 hlen:(Nat.digits 10 19).length = 2k:ℕx✝:k ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < khp:Nat.Prime (concatThrees k 19)hlt:k < 2hk1:k = 1⊢ False
subst hk1 refine_2 hlen:(Nat.digits 10 19).length = 2x✝:1 ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < 1hp:Nat.Prime (concatThrees 1 19)hlt:1 < 2⊢ False
simp only [concatThrees, hlen] at hp refine_2 hlen:(Nat.digits 10 19).length = 2x✝:1 ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < 1hlt:1 < 2hp:Nat.Prime ((10 ^ 1 - 1) / 3 * 10 ^ max 1 2 + 19)⊢ False
exact absurd hp (by hlen:(Nat.digits 10 19).length = 2x✝:1 ∈ {k | 0 < k ∧ Nat.Prime (concatThrees k 19)}hk:0 < 1hlt:1 < 2hp:Nat.Prime ((10 ^ 1 - 1) / 3 * 10 ^ max 1 2 + 19)⊢ ¬Nat.Prime ((10 ^ 1 - 1) / 3 * 10 ^ max 1 2 + 19) norm_num All goals completed! 🐙)Conjecture: For $n \ge 4$, $a(n) > 0$.
@[category research open, AMS 11]
theorem conjecture (n : ℕ) (hn : 4 ≤ n) : 0 < a n := by n:ℕhn:4 ≤ n⊢ 0 < a n
sorry All goals completed! 🐙end OeisA242775