/-
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 FormalConjecturesUtilIntegers $0 < k < n$ with $p = k + \mathrm{prime}(n - k)$ and $\mathrm{prime}(p) - p + 1$ prime
Let $\mathrm{prime}(m)$ denote the $m$-th prime number. The sequence $a(n)$ counts the integers $0 < k < n$ such that $p = k + \mathrm{prime}(n - k)$ and $\mathrm{prime}(p) - p + 1$ are both prime.
References:
@[expose] public sectionnamespace OeisA234694Number of integers $0 < k < n$ such that $p = k + \mathrm{prime}(n - k)$ and $\mathrm{prime}(p) - p + 1$ are both prime, where $\mathrm{prime}(m)$ denotes the $m$-th prime.
noncomputable def a (n : ℕ) : ℕ :=
∑ k ∈ Finset.Ico 1 n,
let p := k + Nat.nth Nat.Prime (n - k - 1)
if p.Prime ∧ Nat.Prime (Nat.nth Nat.Prime (p - 1) - p + 1) then 1 else 0@[category test, AMS 11]
theorem a_1 : a 1 = 0 := ⊢ a 1 = 0
All goals completed! 🐙hIco:Finset.Ico 1 2 = {1}⊢ a 2 = 1
simp only [a, hIco, Finset.sum_singleton, Nat.reduceSub, Nat.reduceAdd,
Nat.nth_prime_zero_eq_two, Nat.nth_prime_two_eq_five] hIco:Finset.Ico 1 2 = {1}⊢ (if Nat.Prime 3 ∧ Nat.Prime 3 then 1 else 0) = 1
decide All goals completed! 🐙
@[category test, AMS 11]
theorem a_3 : a 3 = 0 := by ⊢ a 3 = 0
have hIco : Finset.Ico 1 3 = {1, 2} := by decide hIco:Finset.Ico 1 3 = {1, 2}⊢ a 3 = 0 hIco:Finset.Ico 1 3 = {1, 2}⊢ a 3 = 0
simp only [a, hIco, Finset.sum_insert, Finset.mem_singleton, OfNat.one_ne_ofNat,
not_false_eq_true, Finset.sum_singleton, Nat.reduceSub, Nat.reduceAdd,
Nat.nth_prime_zero_eq_two, Nat.nth_prime_one_eq_three, Nat.nth_prime_three_eq_seven] hIco:Finset.Ico 1 3 = {1, 2}⊢ ((if Nat.Prime 4 ∧ Nat.Prime 4 then 1 else 0) + if Nat.Prime 4 ∧ Nat.Prime 4 then 1 else 0) = 0
decide All goals completed! 🐙
@[category test, AMS 11]
theorem a_4 : a 4 = 2 := by ⊢ a 4 = 2
have hIco : Finset.Ico 1 4 = {1, 2, 3} := by decide hIco:Finset.Ico 1 4 = {1, 2, 3}⊢ a 4 = 2 hIco:Finset.Ico 1 4 = {1, 2, 3}⊢ a 4 = 2
simp only [a, hIco, Finset.sum_insert, Finset.mem_insert, Finset.mem_singleton,
OfNat.one_ne_ofNat, Nat.reduceEqDiff, or_self, not_false_eq_true, Finset.sum_singleton,
Nat.reduceSub, Nat.reduceAdd, Nat.nth_prime_zero_eq_two, Nat.nth_prime_one_eq_three,
Nat.nth_prime_two_eq_five, Nat.nth_prime_four_eq_eleven, Nat.nth_prime_five_eq_thirteen] hIco:Finset.Ico 1 4 = {1, 2, 3}⊢ (if Nat.Prime 6 ∧ Nat.Prime 8 then 1 else 0) +
((if Nat.Prime 5 ∧ Nat.Prime 7 then 1 else 0) + if Nat.Prime 5 ∧ Nat.Prime 7 then 1 else 0) =
2
decide All goals completed! 🐙
@[category test, AMS 11]
theorem a_5 : a 5 = 1 := by ⊢ a 5 = 1
have hIco : Finset.Ico 1 5 = {1, 2, 3, 4} := by decide hIco:Finset.Ico 1 5 = {1, 2, 3, 4}⊢ a 5 = 1 hIco:Finset.Ico 1 5 = {1, 2, 3, 4}⊢ a 5 = 1
simp only [a, hIco, Finset.sum_insert, Finset.mem_insert, Finset.mem_singleton,
OfNat.one_ne_ofNat, Nat.reduceEqDiff, or_self, not_false_eq_true, Finset.sum_singleton,
Nat.reduceSub, Nat.reduceAdd, Nat.nth_prime_zero_eq_two, Nat.nth_prime_one_eq_three,
Nat.nth_prime_two_eq_five, Nat.nth_prime_three_eq_seven, Nat.nth_prime_five_eq_thirteen,
Nat.nth_prime_six_eq_seventeen, Nat.nth_prime_seven_eq_nineteen] hIco:Finset.Ico 1 5 = {1, 2, 3, 4}⊢ (if Nat.Prime 8 ∧ Nat.Prime 12 then 1 else 0) +
((if Nat.Prime 7 ∧ Nat.Prime 11 then 1 else 0) +
((if Nat.Prime 6 ∧ Nat.Prime 8 then 1 else 0) + if Nat.Prime 6 ∧ Nat.Prime 8 then 1 else 0)) =
1
decide All goals completed! 🐙Conjecture (i): $a(n) > 0$ for all $n > 9$.
@[category research open, AMS 11]
theorem conjecture_1 (n : ℕ) (hn : 9 < n) : 0 < a n := by n:ℕhn:9 < n⊢ 0 < a n
sorry All goals completed! 🐙Conjecture (i): For any integer $n > 51$ there is a positive integer $k < n$ such that $p = k + \mathrm{prime}(n - k)$ and $\mathrm{prime}(p) + p + 1$ are both prime.
@[category research open, AMS 11]
theorem conjecture_2 (n : ℕ) (hn : 51 < n) :
∃ k, 0 < k ∧ k < n ∧
let p := k + Nat.nth Nat.Prime (n - k - 1)
p.Prime ∧ Nat.Prime (Nat.nth Nat.Prime (p - 1) + p + 1) := by n:ℕhn:51 < n⊢ ∃ k,
0 < k ∧
k < n ∧
let p := k + Nat.nth Nat.Prime (n - k - 1);
Nat.Prime p ∧ Nat.Prime (Nat.nth Nat.Prime (p - 1) + p + 1)
sorry All goals completed! 🐙Conjecture (ii): If $n > 9$, then there is a positive integer $k < n$ such that $m - 1$ and $\mathrm{prime}(m) + m$ are both prime, where $m = k + \mathrm{prime}(n - k)$.
@[category research open, AMS 11]
theorem conjecture_3 (n : ℕ) (hn : 9 < n) :
∃ k, 0 < k ∧ k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1)
Nat.Prime (m - 1) ∧ Nat.Prime (Nat.nth Nat.Prime (m - 1) + m) := by n:ℕhn:9 < n⊢ ∃ k,
0 < k ∧
k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1);
Nat.Prime (m - 1) ∧ Nat.Prime (Nat.nth Nat.Prime (m - 1) + m)
sorry All goals completed! 🐙Conjecture (ii): If $n > 21$, then there is a positive integer $k < n$ such that $m - 1$ and $\mathrm{prime}(m) - m$ are both prime, where $m = k + \mathrm{prime}(n - k)$.
@[category research open, AMS 11]
theorem conjecture_4 (n : ℕ) (hn : 21 < n) :
∃ k, 0 < k ∧ k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1)
Nat.Prime (m - 1) ∧ Nat.Prime (Nat.nth Nat.Prime (m - 1) - m) := by n:ℕhn:21 < n⊢ ∃ k,
0 < k ∧
k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1);
Nat.Prime (m - 1) ∧ Nat.Prime (Nat.nth Nat.Prime (m - 1) - m)
sorry All goals completed! 🐙Conjecture (iii): If $n > 483$, then for some $0 < k < n$ both $\mathrm{prime}(m) + m$ and $\mathrm{prime}(m) - m$ are prime, where $m = k + \mathrm{prime}(n - k)$.
@[category research open, AMS 11]
theorem conjecture_5 (n : ℕ) (hn : 483 < n) :
∃ k, 0 < k ∧ k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1)
Nat.Prime (Nat.nth Nat.Prime (m - 1) + m) ∧
Nat.Prime (Nat.nth Nat.Prime (m - 1) - m) := by n:ℕhn:483 < n⊢ ∃ k,
0 < k ∧
k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1);
Nat.Prime (Nat.nth Nat.Prime (m - 1) + m) ∧ Nat.Prime (Nat.nth Nat.Prime (m - 1) - m)
sorry All goals completed! 🐙Conjecture (iv): If $n > 3$, then there is a positive integer $k < n$ such that $\mathrm{prime}(k + \mathrm{prime}(n - k)) + 2$ is prime.
@[category research open, AMS 11]
theorem conjecture_6 (n : ℕ) (hn : 3 < n) :
∃ k, 0 < k ∧ k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1)
Nat.Prime (Nat.nth Nat.Prime (m - 1) + 2) := by n:ℕhn:3 < n⊢ ∃ k,
0 < k ∧
k < n ∧
let m := k + Nat.nth Nat.Prime (n - k - 1);
Nat.Prime (Nat.nth Nat.Prime (m - 1) + 2)
sorry All goals completed! 🐙end OeisA234694