/-
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 FormalConjecturesUtilNumber of primes $p \le (n+1)/2$ with $\lfloor\sqrt{n-p}\rfloor$ prime
The sequence $a(n)$ counts the number of primes $p \le \lfloor (n+1)/2 \rfloor$ such that $\lfloor\sqrt{n-p}\rfloor$ is prime.
References:
@[expose] public sectionnamespace OeisA237720$a(n)$ is the number of primes $p \le \lfloor (n+1)/2 \rfloor$ with $\lfloor\sqrt{n-p}\rfloor$ prime.
def a (n : ℕ) : ℕ :=
∑ p ∈ Finset.Icc 1 ((n + 1) / 2),
if p.Prime ∧ (Nat.sqrt (n - p)).Prime then 1 else 0@[category test, AMS 11]
theorem a_1 : a 1 = 0 := ⊢ a 1 = 0 All goals completed! 🐙@[category test, AMS 11]
theorem a_2 : a 2 = 0 := ⊢ a 2 = 0 All goals completed! 🐙@[category test, AMS 11]
theorem a_3 : a 3 = 0 := ⊢ a 3 = 0 All goals completed! 🐙@[category test, AMS 11]
theorem a_4 : a 4 = 0 := ⊢ a 4 = 0 All goals completed! 🐙@[category test, AMS 11]
theorem a_5 : a 5 = 0 := ⊢ a 5 = 0 All goals completed! 🐙@[category test, AMS 11]
theorem a_6 : a 6 = 1 := ⊢ a 6 = 1 All goals completed! 🐙@[category test, AMS 11]
theorem a_7 : a 7 = 2 := ⊢ a 7 = 2 All goals completed! 🐙Conjecture (i): $a(n) > 0$ for all $n > 5$.
@[category research open, AMS 11]
theorem conjecture_1 (n : ℕ) (hn : 5 < n) : 0 < a n := n:ℕhn:5 < n⊢ 0 < a n
All goals completed! 🐙Conjecture: $a(n) = 1$ only for $n = 6, 23, 24, 111, 112, \ldots, 120$.
@[category research open, AMS 11]
theorem conjecture_2 (n : ℕ) :
a n = 1 ↔ n = 6 ∨ n = 23 ∨ n = 24 ∨ (111 ≤ n ∧ n ≤ 120) := n:ℕ⊢ a n = 1 ↔ n = 6 ∨ n = 23 ∨ n = 24 ∨ 111 ≤ n ∧ n ≤ 120
All goals completed! 🐙Conjecture (ii): For any integer $n > 2$, there is a prime $p < n$ with $\lfloor\sqrt{n+p}\rfloor$ prime.
@[category research open, AMS 11]
theorem conjecture_3 (n : ℕ) (hn : 2 < n) :
∃ p : ℕ, p.Prime ∧ p < n ∧ (Nat.sqrt (n + p)).Prime := n:ℕhn:2 < n⊢ ∃ p, Nat.Prime p ∧ p < n ∧ Nat.Prime (n + p).sqrt
All goals completed! 🐙end OeisA237720