Lerch quotients of odd primes
"Is the only Lerch quotient that is itself prime?"
Permanent public credit, certificates, and points. Unpaid; uses your AI plan.
The exact statement
theorem conjecture : ∀ n : ℕ, 1 < n → (a n).Prime → a n = 13"Is the only Lerch quotient that is itself prime?"
Permanent public credit, certificates, and points. Unpaid; uses your AI plan.
theorem conjecture : ∀ n : ℕ, 1 < n → (a n).Prime → a n = 13/-
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
/-!
# Lerch quotients of odd primes
The Lerch quotient of an odd prime $p$ is given by
$$L_p = \frac{\left(\sum_{k=1}^{p-1} q_p(k)\right) - w_p}{p}$$
where $q_p(k) = (k^{p-1}-1)/p$ is the Fermat quotient and $w_p = ((p-1)!+1)/p$ is the Wilson
quotient. For $n > 1$, $a(n)$ is the Lerch quotient of the $n$-th prime $p_n$.
*References:*
- [A197630](https://oeis.org/A197630)
-/
@[expose] public section
namespace OeisA197630
/-- The Fermat quotient $q_p(k) = (k^{p-1}-1)/p$. -/
def fermatQuotient (k p : ℕ) : ℤ :=
((k : ℤ) ^ (p - 1) - 1) / (p : ℤ)
/-- The Wilson quotient $w_p = ((p-1)!+1)/p$. -/
def wilsonQuotient (p : ℕ) : ℤ :=
((p - 1).factorial + 1 : ℤ) / (p : ℤ)
/-- The Lerch quotient of $p$:
$\frac{(\sum_{k=1}^{p-1} q_p(k)) - w_p}{p}$. -/
def lerchQuotient (p : ℕ) : ℕ :=
let sumQ : ℤ := ∑ k ∈ Finset.Ico 1 p, fermatQuotient k p
((sumQ - wilsonQuotient p) / (p : ℤ)).natAbs
/-- Lerch quotients of odd primes: $a(n)$ is the Lerch quotient of the $n$-th prime $p_n$ for
$n > 1$, and $0$ for $n \le 1$. -/
noncomputable def a (n : ℕ) : ℕ :=
if 1 < n then
lerchQuotient (Nat.nth Nat.Prime (n - 1))
else
0
@[category test, AMS 11]
theorem a_2 : a 2 = 0 := by
simp only [a, show (2 - 1 : ℕ) = 1 by rfl, Nat.nth_prime_one_eq_three]
decide
@[category test, AMS 11]
theorem a_3 : a 3 = 13 := by
simp only [a, show (3 - 1 : ℕ) = 2 by rfl, Nat.nth_prime_two_eq_five]
decide
@[category test, AMS 11]
theorem a_4 : a 4 = 1356 := by
simp only [a, show (4 - 1 : ℕ) = 3 by rfl, Nat.nth_prime_three_eq_seven]
decide
@[category test, AMS 11]
theorem a_5 : a 5 = 123229034 := by
simp only [a, show (5 - 1 : ℕ) = 4 by rfl, Nat.nth_prime_four_eq_eleven]
decide
@[category test, AMS 11]
theorem a_6 : a 6 = 79417031713 := by
simp only [a, show (6 - 1 : ℕ) = 5 by rfl, Nat.nth_prime_five_eq_thirteen]
decide +kernel
/--
"Is $13$ the only Lerch quotient that is itself prime?"
-/
@[category research open, question, AMS 11]
theorem conjecture : ∀ n : ℕ, 1 < n → (a n).Prime → a n = 13 := by
sorry
end OeisA197630