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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Stern Primes

Source:Wikipedia lists of open problems
Open problem Nobody knows the answer yet — neither on paper nor in Lean. First verified proof: +100 points.
Statement:reviewed
Statement:

Is the set of Stern primes finite? Euler's representation heuristic suggests that only finitely many primes avoid the form p+2b2p + 2 b^2.

Subjects:Number Theory (math.NT)
MSC classes:11
Tags:question
Cite as:NS.08524 [math.NT] · NS.08524v1 for this version
Declaration:SternPrime.stern_primes_finite
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 100, later ones: 10; accepted critique: up to 60
Statement hash:217f4f483e10105ae17a890eb1ef1e85a91e7b2943cb7ffc4136225993470eff
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/Wikipedia/SternPrime.lean

Formal statement

theorem stern_primes_finite : {q : ℕ | IsSternPrime q}.Finite
Show the full Challenge.lean (103 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Stern Primes

As recounted by Laurent Hodges (1993), Christian Goldbach proposed in a 1752 letter to Euler that
every odd integer greater than $1$ equals $p + 2 b^2$ with $b \ge 0$ (counting $1$ as prime); for
modern primes, its nontrivial content is the *Goldbach–Stern conjecture* that every odd composite
equals $p + 2 b^2$ with $p$ prime and $b \ge 1$. Moritz Abraham Stern (1856) refuted this via the
counterexamples $5777$ and $5993$ (`OEIS A060003`).

A prime $q$ admitting no decomposition $q = p + 2 b^2$ with $p$ prime and $b \ge 1$ is called a
*Stern prime* (`OEIS A042978`). Only eight examples are known ($2, 3, 17, 137, 227, 977, 1187$, and
$1493$); Euler noted heuristically that larger primes acquire more decompositions $p + 2 b^2$,
suggesting that Stern primes form a finite set and that $1493$ may be the largest.

*References:*
- [Wikipedia](https://en.wikipedia.org/wiki/Stern_prime)
- [OEIS A042978](https://oeis.org/A042978)
- M. A. Stern, *Sur une assertion de Goldbach relative aux nombres impairs*, Nouv. Ann. Math.
  **15** (1856), 23–24.
- L. Hodges, *A lesser-known Goldbach conjecture*, Math. Mag. **66** (1993), no. 1, 45–47.
-/

@[expose] public section

namespace SternPrime

/-- Predicate asserting that $n = p + 2 b^2$ for some prime $p$ and integer $b \ge 1$. -/
def HasPrimePlusTwiceSquare (n : ℕ) : Prop :=
  ∃ p b : ℕ, p.Prime ∧ 1 ≤ b ∧ n = p + 2 * b ^ 2

/-- Predicate asserting that $q$ is prime and fails `HasPrimePlusTwiceSquare`. -/
def IsSternPrime (q : ℕ) : Prop :=
  q.Prime ∧ ¬ HasPrimePlusTwiceSquare q

instance (n : ℕ) : Decidable (HasPrimePlusTwiceSquare n) :=
  decidable_of_iff (∃ b < n.sqrt + 1, 1 ≤ b ∧ 2 * b ^ 2 < n ∧ (n - 2 * b ^ 2).Prime) <| by
    unfold HasPrimePlusTwiceSquare
    constructor
    · rintro ⟨b, _, hb, hlt, hp⟩
      exact ⟨n - 2 * b ^ 2, b, hp, hb, by omega⟩
    · rintro ⟨p, b, hp, hb, rfl⟩
      have hp_pos : 0 < p := hp.pos
      have hb_sqrt : b ≤ (p + 2 * b ^ 2).sqrt := Nat.le_sqrt.mpr (by nlinarith)
      exact ⟨b, by omega, hb, by omega, by simpa using hp⟩

instance (q : ℕ) : Decidable (IsSternPrime q) :=
  inferInstanceAs (Decidable (q.Prime ∧ ¬ HasPrimePlusTwiceSquare q))

/-- Verifies that all eight known examples $2, 3, 17, 137, 227, 977, 1187, 1493$ are Stern
primes. -/
@[category test, AMS 11]
theorem isSternPrime_known_examples :
    ∀ q ∈ ([2, 3, 17, 137, 227, 977, 1187, 1493] : List ℕ), IsSternPrime q := by
  decide +kernel

/-- Checks that $5 = 3 + 2 \cdot 1^2$ and $11 = 3 + 2 \cdot 2^2$ satisfy `HasPrimePlusTwiceSquare`
and hence are not Stern primes. -/
@[category test, AMS 11]
theorem not_isSternPrime_five_and_eleven :
    HasPrimePlusTwiceSquare 5 ∧ HasPrimePlusTwiceSquare 11 ∧
      ¬ IsSternPrime 5 ∧ ¬ IsSternPrime 11 := by
  have h5 : HasPrimePlusTwiceSquare 5 := ⟨3, 1, by norm_num, by omega, by norm_num⟩
  have h11 : HasPrimePlusTwiceSquare 11 := ⟨3, 2, by norm_num, by omega, by norm_num⟩
  exact ⟨h5, h11, fun h => h.2 h5, fun h => h.2 h11⟩

/--
Is the set of Stern primes finite? Euler's representation heuristic suggests that only finitely
many primes avoid the form $p + 2 b^2$.
-/
@[category research open, question, AMS 11]
theorem stern_primes_finite : {q : ℕ | IsSternPrime q}.Finite := by
  sorry

/--
Does $\{2, 3, 17, 137, 227, 977, 1187, 1493\}$ exhaust all Stern primes? No ninth example appears
among the first $100{,}000$ primes (McCranie) or below $2 \times 10^{13}$ (Chaffin, `OEIS A042978`).
-/
@[category research open, question, AMS 11]
theorem isSternPrime_iff :
    ∀ q : ℕ, IsSternPrime q ↔ q ∈ ({2, 3, 17, 137, 227, 977, 1187, 1493} : Set ℕ) := by
  sorry

end SternPrime

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

nosorry fetch wikipedia-sternprime
nosorry submit wikipedia-sternprime nosorry/wikipedia-sternprime/Solution.lean --wait

Formal variants

Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.

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.