/- 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 FormalConjecturesUtil

Ordered ways to write $2n = p + q$ with $p, q$ and $p_{p+2} + 2$ all prime

Let $p_k$ denote the $k$-th prime number. The sequence $a(n)$ counts the number of ordered ways to write $2n = p + q$ with $p, q$, and $p_{p+2} + 2$ all prime.

References:

@[expose] public sectionnamespace OeisA236566

$a(n)$ is the number of ordered ways to write $2n = p + q$ with $p, q$ and $\operatorname{prime}(p + 2) + 2$ all prime.

noncomputable def a (n : ℕ) : ℕ := ∑ p ∈ Finset.range (2 * n), if p.Prime ∧ (2 * n - p).Prime ∧ (Nat.nth Nat.Prime (p + 1) + 2).Prime then 1 else 0h:Finset.range 2 = {0, 1}⊢ a 1 = 0 h:Finset.range 2 = {0, 1}⊢ ((if Nat.Prime 0 ∧ Nat.Prime (2 - 0) ∧ Nat.Prime (Nat.nth Nat.Prime (0 + 1) + 2) then 1 else 0) + if Nat.Prime 1 ∧ Nat.Prime (2 - 1) ∧ Nat.Prime (Nat.nth Nat.Prime (1 + 1) + 2) then 1 else 0) = 0 All goals completed! 🐙h:Finset.range 4 = {0, 1, 2, 3}⊢ a 2 = 0 h:Finset.range 4 = {0, 1, 2, 3}⊢ (if Nat.Prime 0 ∧ Nat.Prime (4 - 0) ∧ Nat.Prime (Nat.nth Nat.Prime 1 + 2) then 1 else 0) + ((if Nat.Prime 1 ∧ Nat.Prime (4 - 1) ∧ Nat.Prime (Nat.nth Nat.Prime 2 + 2) then 1 else 0) + ((if Nat.Prime 2 ∧ Nat.Prime (4 - 2) ∧ Nat.Prime 9 then 1 else 0) + if Nat.Prime 3 ∧ Nat.Prime (4 - 3) ∧ Nat.Prime (Nat.nth Nat.Prime 4 + 2) then 1 else 0)) = 0 All goals completed! 🐙h:Finset.range 6 = {0, 1, 2, 3, 4, 5}⊢ a 3 = 1 h:Finset.range 6 = {0, 1, 2, 3, 4, 5}⊢ (if Nat.Prime 0 ∧ Nat.Prime (6 - 0) ∧ Nat.Prime (Nat.nth Nat.Prime 1 + 2) then 1 else 0) + ((if Nat.Prime 1 ∧ Nat.Prime (6 - 1) ∧ Nat.Prime (Nat.nth Nat.Prime 2 + 2) then 1 else 0) + ((if Nat.Prime 2 ∧ Nat.Prime (6 - 2) ∧ Nat.Prime 9 then 1 else 0) + ((if Nat.Prime 3 ∧ Nat.Prime (6 - 3) ∧ Nat.Prime 13 then 1 else 0) + ((if Nat.Prime 4 ∧ Nat.Prime (6 - 4) ∧ Nat.Prime (Nat.nth Nat.Prime 5 + 2) then 1 else 0) + if Nat.Prime 5 ∧ Nat.Prime (6 - 5) ∧ Nat.Prime (Nat.nth Nat.Prime 6 + 2) then 1 else 0)))) = 1 All goals completed! 🐙h:Finset.range 8 = {0, 1, 2, 3, 4, 5, 6, 7}⊢ a 4 = 2 h:Finset.range 8 = {0, 1, 2, 3, 4, 5, 6, 7}⊢ (if Nat.Prime 0 ∧ Nat.Prime (8 - 0) ∧ Nat.Prime (Nat.nth Nat.Prime 1 + 2) then 1 else 0) + ((if Nat.Prime 1 ∧ Nat.Prime (8 - 1) ∧ Nat.Prime (Nat.nth Nat.Prime 2 + 2) then 1 else 0) + ((if Nat.Prime 2 ∧ Nat.Prime (8 - 2) ∧ Nat.Prime (Nat.nth Nat.Prime 3 + 2) then 1 else 0) + ((if Nat.Prime 3 ∧ Nat.Prime (8 - 3) ∧ Nat.Prime 13 then 1 else 0) + ((if Nat.Prime 4 ∧ Nat.Prime (8 - 4) ∧ Nat.Prime (Nat.nth Nat.Prime 5 + 2) then 1 else 0) + ((if Nat.Prime 5 ∧ Nat.Prime (8 - 5) ∧ Nat.Prime 19 then 1 else 0) + ((if Nat.Prime 6 ∧ Nat.Prime (8 - 6) ∧ Nat.Prime (Nat.nth Nat.Prime 7 + 2) then 1 else 0) + if Nat.Prime 7 ∧ Nat.Prime (8 - 7) ∧ Nat.Prime (Nat.nth Nat.Prime 8 + 2) then 1 else 0)))))) = 2 All goals completed! 🐙h:Finset.range 10 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}⊢ a 5 = 2 h:Finset.range 10 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}⊢ (if Nat.Prime 0 ∧ Nat.Prime (10 - 0) ∧ Nat.Prime (Nat.nth Nat.Prime 1 + 2) then 1 else 0) + ((if Nat.Prime 1 ∧ Nat.Prime (10 - 1) ∧ Nat.Prime (Nat.nth Nat.Prime 2 + 2) then 1 else 0) + ((if Nat.Prime 2 ∧ Nat.Prime (10 - 2) ∧ Nat.Prime (Nat.nth Nat.Prime 3 + 2) then 1 else 0) + ((if Nat.Prime 3 ∧ Nat.Prime (10 - 3) ∧ Nat.Prime 13 then 1 else 0) + ((if Nat.Prime 4 ∧ Nat.Prime (10 - 4) ∧ Nat.Prime (Nat.nth Nat.Prime 5 + 2) then 1 else 0) + ((if Nat.Prime 5 ∧ Nat.Prime (10 - 5) ∧ Nat.Prime 19 then 1 else 0) + ((if Nat.Prime 6 ∧ Nat.Prime (10 - 6) ∧ Nat.Prime (Nat.nth Nat.Prime 7 + 2) then 1 else 0) + ((if Nat.Prime 7 ∧ Nat.Prime (10 - 7) ∧ Nat.Prime 25 then 1 else 0) + ((if Nat.Prime 8 ∧ Nat.Prime (10 - 8) ∧ Nat.Prime (Nat.nth Nat.Prime 9 + 2) then 1 else 0) + if Nat.Prime 9 ∧ Nat.Prime (10 - 9) ∧ Nat.Prime (Nat.nth Nat.Prime 10 + 2) then 1 else 0)))))))) = 2 All goals completed! 🐙

Conjecture: (i) $a(n) > 0$ for all $n > 2$.

@[category research open, AMS 11] theorem conjecture_1 (n : ℕ) (hn : 2 < n) : 0 < a n := n:ℕhn:2 < n⊢ 0 < a n All goals completed! 🐙

Conjecture: (ii) If $n > 30$, then $2n + 1$ can be written as $2p + q$ with $p$, $q$ and $\operatorname{prime}(p + 2) + 2$ all prime.

@[category research open, AMS 11] theorem conjecture_2 (n : ℕ) (hn : 30 < n) : ∃ p q : ℕ, p.Prime ∧ q.Prime ∧ (Nat.nth Nat.Prime (p + 1) + 2).Prime ∧ 2 * n + 1 = 2 * p + q := n:ℕhn:30 < n⊢ ∃ p q, Nat.Prime p ∧ Nat.Prime q ∧ Nat.Prime (Nat.nth Nat.Prime (p + 1) + 2) ∧ 2 * n + 1 = 2 * p + q All goals completed! 🐙end OeisA236566