/-
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 integers $0 < k < n$ such that $(k + 1)^{\phi(n - k)} + k$ is prime
For $n \ge 1$, $a(n)$ counts the integers $0 < k < n$ for which $(k + 1)^{\phi(n - k)} + k$ is prime, where $\phi$ is Euler's totient function.
References:
T. Adamczewski, "OEIS Open: How many conjectures can language models turn into theorems?", arXiv:2608.11941 [cs.AI], 2026.
@[expose] public sectionnamespace OeisA234360Number of integers $0 < k < n$ such that $(k + 1)^{\phi(n - k)} + k$ is prime, where $\phi$ is Euler's totient function.
def a (n : ℕ) : ℕ :=
(Finset.filter (fun k =>
Nat.Prime ((k + 1) ^ (n - k).totient + k)
) (Finset.Ico 1 n)).card@[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 = 1 := ⊢ a 2 = 1 All goals completed! 🐙@[category test, AMS 11]
theorem a_3 : a 3 = 2 := ⊢ a 3 = 2 All goals completed! 🐙@[category test, AMS 11]
theorem a_4 : a 4 = 3 := ⊢ a 4 = 3 All goals completed! 🐙@[category test, AMS 11]
theorem a_5 : a 5 = 3 := ⊢ a 5 = 3 All goals completed! 🐙Conjecture (i): $a(n) > 0$ for all $n > 1$.
@[category research open, AMS 11]
theorem conjecture_1 (n : ℕ) (hn : 1 < n) : 0 < a n := n:ℕhn:1 < n⊢ 0 < a n
All goals completed! 🐙Conjecture (i): For any $n > 5$ there is a positive integer $k < n$ with $(k + 1)^{\phi(n - k) / 2} - k$ prime.
Disproved for $n = 1408$ in the OEIS Open project, see T. Adamczewski, OEIS Open: How many conjectures can language models turn into theorems?, arXiv:2608.11941.
@[category research solved, AMS 11]
theorem conjecture_2 :
¬ ∀ n : ℕ, 5 < n →
∃ k, 0 < k ∧ k < n ∧
∃ p : ℕ, p.Prime ∧ (p + k) ^ 2 = (k + 1) ^ (n - k).totient := ⊢ ¬∀ (n : ℕ), 5 < n → ∃ k, 0 < k ∧ k < n ∧ ∃ p, Nat.Prime p ∧ (p + k) ^ 2 = (k + 1) ^ (n - k).totient
All goals completed! 🐙Conjecture (ii): If $n > 1$, then $k(k + 1)^{\phi(n - k)} + 1$ is prime for some $0 < k < n$.
@[category research open, AMS 11]
theorem conjecture_3 (n : ℕ) (hn : 1 < n) :
∃ k, 0 < k ∧ k < n ∧ Nat.Prime (k * (k + 1) ^ (n - k).totient + 1) := n:ℕhn:1 < n⊢ ∃ k, 0 < k ∧ k < n ∧ Nat.Prime (k * (k + 1) ^ (n - k).totient + 1)
All goals completed! 🐙Conjecture (ii): If $n > 3$, then $k(k + 1)^{\phi(n - k) / 2} - 1$ is prime for some $0 < k < n$.
@[category research open, AMS 11]
theorem conjecture_4 (n : ℕ) (hn : 3 < n) :
∃ k, 0 < k ∧ k < n ∧
∃ p : ℕ, p.Prime ∧ (p + 1) ^ 2 = k ^ 2 * (k + 1) ^ (n - k).totient := n:ℕhn:3 < n⊢ ∃ k, 0 < k ∧ k < n ∧ ∃ p, Nat.Prime p ∧ (p + 1) ^ 2 = k ^ 2 * (k + 1) ^ (n - k).totient
All goals completed! 🐙end OeisA234360