Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Lesser of twin primes

Source:OEIS conjectures
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Primes pkp_k such that pk!≡1(modpk+1)p_k! \equiv 1 \pmod{p_{k+1}} with the exception of p991=7841p_{991} = 7841 and other unknown primes pkp_k for which (pk+1)(pk+2)⋯(pk+1−2)≡1(modpk+1)(p_k+1)(p_k+2)\cdots(p_{k+1}-2) \equiv 1 \pmod{p_{k+1}} where pk+1−pk>2p_{k+1} - p_k > 2.

A formal proof is hosted at the formal_proof link: a Wilson-theorem argument with a fixed-divisor trial-division sieve and a verified length-7840 certificate.

Subjects:Number Theory (math.NT)
MSC classes:11
Tags:formal_proof
Cite as:NS.04934 [math.NT] · NS.04934v1 for this version
Declaration:OeisA1359.conjecture
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:aa5d4b2ec16320ffaacb8feb27a5f5944c161b8c1969ffb5e0971e74f88c3418
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/1359.lean

Formal statement

theorem conjecture (k : ℕ) (hk : k > 1) :
    let Pk := Nat.nth Nat.Prime (k - 1)
    let Pk_succ := Nat.nth Nat.Prime k
    let Congruence := Pk.factorial ≡ 1 [MOD Pk_succ]
    let IsLesserTwinPrime := (Pk + 2).Prime
    let Wk_prod : ℕ := ∏ i ∈ Finset.Icc (Pk + 1) (Pk_succ - 2), i
    Congruence ↔ (IsLesserTwinPrime ∨ (k = 991) ∨ (Pk_succ - Pk > 2 ∧ Wk_prod ≡ 1 [MOD Pk_succ]))
Show the full Challenge.lean (91 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Lesser of twin primes

Primes $p$ such that $p+2$ is also prime.

*References:*
- [A001359](https://oeis.org/A001359)
-/

@[expose] public section

namespace OeisA1359

/-- The $n$-th lesser twin prime, with $a(0) = 0$. -/
noncomputable def a (n : ℕ) : ℕ :=
  if n > 0 then
    Nat.nth (fun p => p.Prime ∧ (p + 2).Prime) (n - 1)
  else
    0

/-- Value of the sequence `a` at 0. -/
@[category test, AMS 11]
theorem a_0 : a 0 = 0 := by rfl

/-- Value of the sequence `a` at 1. -/
@[category test, AMS 11]
theorem a_1 : a 1 = 3 := by
  norm_num[a]
  exact(((congr_arg _) (by constructor) )).trans.comp (3).nth_count (by decide)

/-- Value of the sequence `a` at 2. -/
@[category test, AMS 11]
theorem a_2 : a 2 = 5 := by
  delta a
  apply((congr_arg _) (by constructor) ).trans (Nat.nth_count (by decide ) )

/-- Value of the sequence `a` at 3. -/
@[category test, AMS 11]
theorem a_3 : a 3 = 11 := by
  (inhabit ℝ)
  norm_num[a]
  exact (congr_arg _ (by decide)).trans (Nat.nth_count (by decide))

/-- Value of the sequence `a` at 4. -/
@[category test, AMS 11]
theorem a_4 : a 4 = 17 := by
  simp_all[a]
  exact (congr_arg _ (by constructor) ).trans (Nat.nth_count (by decide))

set_option linter.style.formal_proof_palomar false in
/--
Primes $p_k$ such that $p_k! \equiv 1 \pmod{p_{k+1}}$ with the exception of $p_{991} = 7841$ and
other unknown primes $p_k$ for which $(p_k+1)(p_k+2)\cdots(p_{k+1}-2) \equiv 1 \pmod{p_{k+1}}$
where $p_{k+1} - p_k > 2$.

A formal proof is hosted at the `formal_proof` link: a Wilson-theorem argument with a
fixed-divisor trial-division sieve and a verified length-7840 certificate.
-/
@[category research solved, AMS 11, formal_proof using formal_conjectures at
"https://github.com/robzilla1738/formal-conjectures/blob/c7de1452e5b9b8165a30466637b83f7fedfb95fe/FormalConjectures/OEIS/1359.lean#L589"]
theorem conjecture (k : ℕ) (hk : k > 1) :
    let Pk := Nat.nth Nat.Prime (k - 1)
    let Pk_succ := Nat.nth Nat.Prime k
    let Congruence := Pk.factorial ≡ 1 [MOD Pk_succ]
    let IsLesserTwinPrime := (Pk + 2).Prime
    let Wk_prod : ℕ := ∏ i ∈ Finset.Icc (Pk + 1) (Pk_succ - 2), i
    Congruence ↔ (IsLesserTwinPrime ∨ (k = 991) ∨ (Pk_succ - Pk > 2 ∧ Wk_prod ≡ 1 [MOD Pk_succ])) :=
        by
  sorry

end OeisA1359

To prove it: keep every definition of Challenge.lean unchanged and prove OeisA1359.conjecture with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_conjecture : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch oeis-1359
nosorry submit oeis-1359 nosorry/oeis-1359/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.